Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Insert data of more than 4000 characters in clob datatype Pin
David Crow17-Feb-10 3:06
David Crow17-Feb-10 3:06 
QuestionApplication Theme changes automatically Pin
Harsh Shankar15-Feb-10 20:27
Harsh Shankar15-Feb-10 20:27 
AnswerRe: Application Theme changes automatically Pin
Eugen Podsypalnikov16-Feb-10 6:41
Eugen Podsypalnikov16-Feb-10 6:41 
GeneralRe: Application Theme changes automatically Pin
Harsh Shankar17-Feb-10 6:31
Harsh Shankar17-Feb-10 6:31 
QuestionSimilar to CWin::SetForegroundWindow method in CWinAppEx Pin
mmayur15-Feb-10 19:54
mmayur15-Feb-10 19:54 
AnswerRe: Similar to CWin::SetForegroundWindow method in CWinAppEx Pin
«_Superman_»15-Feb-10 20:56
professional«_Superman_»15-Feb-10 20:56 
AnswerRe: Similar to CWin::SetForegroundWindow method in CWinAppEx Pin
KingsGambit15-Feb-10 20:58
KingsGambit15-Feb-10 20:58 
AnswerRe: Similar to CWin::SetForegroundWindow method in CWinAppEx [modified] Pin
SandipG 15-Feb-10 21:21
SandipG 15-Feb-10 21:21 
As others have pointed out you should use Mutex to avoid the multiple instances.
Here is code snippet how it will look(not tested)

HANDLE hMutexOneInstance = CreateMutex(NULL, FALSE, _T("Global\\MutexToAvoidMultipleInstances"));
 DWORD dLastErr = ::GetLastError();
 if(dLastErr == ERROR_ALREADY_EXISTS)
 {
           // Here you can use FindWindow based on your window calss/name to get the handle of
           // previous instance.
     CWnd * pPrevCWnd = PreviousInstance();//You have to implement.
     if(pPrevCWnd != NULL)   // If this isn't the first instance
     {
              // In this you should launch the previous window using functions that other replies have
              // suggested. One catch here is if previous instance has some modal dialog open you
              // should set focus to that window. Modal window handle can be retrieved using
              // GetLastActivePopup()[edit] Tried a sample but focus was moving to parent
               need to check more :)[/edit]
        LaunchPrevInstance(pPrevCWnd); // You have to implement..

     }
     else {
         AfxMessageBox("Only one instance is allowed.");
     }
     return FALSE;
 }
Regards,
Sandip.
modified on Tuesday, February 16, 2010 3:34 AM

AnswerRe: Similar to CWin::SetForegroundWindow method in CWinAppEx Pin
mmayur18-Feb-10 19:37
mmayur18-Feb-10 19:37 
Questioninsert text in video Pin
Game-point15-Feb-10 19:48
Game-point15-Feb-10 19:48 
AnswerRe: insert text in video Pin
Code-o-mat15-Feb-10 22:09
Code-o-mat15-Feb-10 22:09 
GeneralRe: insert text in video Pin
Game-point15-Feb-10 23:45
Game-point15-Feb-10 23:45 
GeneralRe: insert text in video [modified] Pin
Code-o-mat16-Feb-10 0:06
Code-o-mat16-Feb-10 0:06 
GeneralRe: insert text in video Pin
Game-point16-Feb-10 0:16
Game-point16-Feb-10 0:16 
GeneralRe: insert text in video Pin
Code-o-mat16-Feb-10 0:32
Code-o-mat16-Feb-10 0:32 
GeneralRe: insert text in video Pin
Game-point16-Feb-10 0:35
Game-point16-Feb-10 0:35 
QuestionHow can I run an MFC Application as a Console Application Pin
Reitz00015-Feb-10 14:17
Reitz00015-Feb-10 14:17 
AnswerRe: How can I run an MFC Application as a Console Application Pin
Luc Pattyn15-Feb-10 14:23
sitebuilderLuc Pattyn15-Feb-10 14:23 
GeneralRe: How can I run an MFC Application as a Console Application Pin
«_Superman_»15-Feb-10 17:08
professional«_Superman_»15-Feb-10 17:08 
AnswerRe: How can I run an MFC Application as a Console Application Pin
Emilio Garavaglia15-Feb-10 22:44
Emilio Garavaglia15-Feb-10 22:44 
QuestionHow to get DLL's path? Pin
John578815-Feb-10 12:24
John578815-Feb-10 12:24 
AnswerRe: How to get DLL's path? Pin
Chris Losinger15-Feb-10 14:13
professionalChris Losinger15-Feb-10 14:13 
QuestionCan someone help with a TRIVIAL database problem Pin
DaveHitchman15-Feb-10 9:32
DaveHitchman15-Feb-10 9:32 
AnswerRe: Can someone help with a TRIVIAL database problem Pin
CPallini15-Feb-10 20:54
mveCPallini15-Feb-10 20:54 
Questionh_addr_list of gethostbyname returns negative values for google.com or other servers like example.com [modified] Pin
Jayapal Chandran15-Feb-10 9:18
Jayapal Chandran15-Feb-10 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.