Click here to Skip to main content
15,923,197 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: #ifdef Pin
Zibar2-Jun-03 10:39
sussZibar2-Jun-03 10:39 
Generalcorrection Pin
Zibar2-Jun-03 4:29
sussZibar2-Jun-03 4:29 
GeneralShell Programming ICopyHook....Please help Pin
rohit.dhamija2-Jun-03 2:15
rohit.dhamija2-Jun-03 2:15 
GeneralInverse of a matrix Pin
affzan2-Jun-03 1:42
affzan2-Jun-03 1:42 
GeneralRe: Inverse of a matrix Pin
Niall Barr2-Jun-03 2:26
professionalNiall Barr2-Jun-03 2:26 
GeneralRe: Inverse of a matrix Pin
Rage2-Jun-03 2:27
professionalRage2-Jun-03 2:27 
GeneralRe: Inverse of a matrix Pin
Abbas_Riazi2-Jun-03 20:39
professionalAbbas_Riazi2-Jun-03 20:39 
GeneralJust one instance of an application Pin
doctorpi2-Jun-03 0:53
doctorpi2-Jun-03 0:53 
Hi guys
What I have to do to execute just once an application?
My problem is that I've tried the below code in the initinstace of the app but I have 2 problems

First is that the second time I start the app, the window of the app doesn't get the focus.
And another more complicated is that sometimes my app is crashing and when this happens it never can start again.
Why do you suggest me?
Best Regards

::CreateMutex(NULL,TRUE,m_pszExeName);
if (GetLastError()==ERROR_ALREADY_EXISTS)
{
CWnd *pPrevWnd = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD);
while (pPrevWnd) {
if (::GetProp(pPrevWnd->GetSafeHwnd(),m_pszExeName)) {
if (pPrevWnd->IsIconic())
pPrevWnd->ShowWindow(SW_RESTORE);
pPrevWnd->SetForegroundWindow();
pPrevWnd->GetLastActivePopup()->SetForegroundWindow();

return FALSE;
}

pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT);
}
return FALSE;
}

GeneralRe: Just one instance of an application Pin
Rage2-Jun-03 2:29
professionalRage2-Jun-03 2:29 
GeneralRe: Just one instance of an application Pin
David Crow2-Jun-03 2:30
David Crow2-Jun-03 2:30 
GeneralRe: Just one instance of an application Pin
doctorpi2-Jun-03 3:51
doctorpi2-Jun-03 3:51 
GeneralMFC application with ATL object Pin
Brian van der Beek2-Jun-03 0:51
Brian van der Beek2-Jun-03 0:51 
GeneralRe: MFC application with ATL object Pin
Brian van der Beek2-Jun-03 1:29
Brian van der Beek2-Jun-03 1:29 
GeneralNeed to get the available domains (win NT) Pin
sarambur2-Jun-03 0:32
sarambur2-Jun-03 0:32 
GeneralRe: Need to get the available domains (win NT) Pin
David Crow2-Jun-03 2:48
David Crow2-Jun-03 2:48 
GeneralAbout Visual C++ ODBC Pin
jcpooh1-Jun-03 23:35
jcpooh1-Jun-03 23:35 
GeneralRe: About Visual C++ ODBC Pin
storein2-Jun-03 0:17
storein2-Jun-03 0:17 
GeneralRe: About Visual C++ ODBC Pin
jcpooh2-Jun-03 15:15
jcpooh2-Jun-03 15:15 
GeneralSub classing a ActiveX control Pin
Mayank Goyal1-Jun-03 23:35
Mayank Goyal1-Jun-03 23:35 
Generalexctract avi properties Pin
cbiacca1-Jun-03 23:28
cbiacca1-Jun-03 23:28 
GeneralRe: exctract avi properties Pin
Rage2-Jun-03 1:06
professionalRage2-Jun-03 1:06 
GeneralCall ID for VC Pin
storein1-Jun-03 23:23
storein1-Jun-03 23:23 
GeneralRe: Call ID for VC Pin
melwyn2-Jun-03 2:48
melwyn2-Jun-03 2:48 
GeneralRe: Call ID for VC Pin
storein2-Jun-03 15:04
storein2-Jun-03 15:04 
GeneralRe: Call ID for VC Pin
melwyn2-Jun-03 20:45
melwyn2-Jun-03 20:45 

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.