Click here to Skip to main content
15,902,198 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: button to send message Pin
Member 216100425-Aug-05 16:49
Member 216100425-Aug-05 16:49 
GeneralRe: button to send message Pin
dharani25-Aug-05 17:35
dharani25-Aug-05 17:35 
GeneralRe: button to send message Pin
Member 216100425-Aug-05 18:06
Member 216100425-Aug-05 18:06 
GeneralRe: button to send message Pin
namaskaaram25-Aug-05 22:31
namaskaaram25-Aug-05 22:31 
AnswerRe: button to send message Pin
10244225-Aug-05 20:18
10244225-Aug-05 20:18 
General[Message Deleted] Pin
Member 216100425-Aug-05 20:47
Member 216100425-Aug-05 20:47 
GeneralRe: button to send message Pin
Member 216100425-Aug-05 20:55
Member 216100425-Aug-05 20:55 
Questionblock main thread and allow secondary to run first Pin
elephantstar25-Aug-05 11:27
elephantstar25-Aug-05 11:27 
I have an external application that launches my application. I have a global variable that determines whether my app was launched via the other app or just by opening the executable. If launched via the other application, two processes or instances gets created and the global variable is set to 1. The first instance will be created but the window frame will not be shown. The other instance will display the window. One instance has the global value initialized to 0 while the other one has it set to 1. I need to block the instance that has global variable = 0 and let the other one run. Once that thread completes, I want the other thread (I believe it’s the main thread) to continue running. I tried using a mutex around my code but it still seems to be doing context-switching. How can I put a hold on thread1? I’ve tried using events but no such luck. This is what I have. Thanks!
<pre>
InitInstance()
{
mutex = ::CreateMutex(NULL, FALSE, “X”);
if(mutex==NULL)
{
AfxMessageBox("Error: Problem with creating the mutex");
return FALSE;
}
else {
WaitForSingleObject(mutex, INFINITE);
if (!bGlobalVariable)
{
OneInstance = ::CreateMutex(NULL, FALSE, “instance”);
DWORD dwMutexErr = GetLastError();
if (dwMutexErr == ERROR_ALREADY_EXISTS)
return FALSE;
}
ReleaseMutex(mutex);
}

if (!GlobalVariable)
//show window
return TRUE;
}
</pre>


-- modifed at 17:51 Thursday 25th August, 2005
QuestionUnwinding from a stack of dialogs... Pin
charlieg25-Aug-05 10:21
charlieg25-Aug-05 10:21 
AnswerRe: Unwinding from a stack of dialogs... Pin
dharani25-Aug-05 17:37
dharani25-Aug-05 17:37 
GeneralRe: Unwinding from a stack of dialogs... Pin
charlieg25-Aug-05 17:43
charlieg25-Aug-05 17:43 
GeneralRe: Unwinding from a stack of dialogs... Pin
namaskaaram25-Aug-05 23:46
namaskaaram25-Aug-05 23:46 
GeneralRe: Unwinding from a stack of dialogs... Pin
charlieg26-Aug-05 2:34
charlieg26-Aug-05 2:34 
GeneralRe: Unwinding from a stack of dialogs... Pin
namaskaaram26-Aug-05 4:31
namaskaaram26-Aug-05 4:31 
AnswerRe: Unwinding from a stack of dialogs... Pin
charlieg26-Aug-05 10:13
charlieg26-Aug-05 10:13 
Questiongetting first root node of treeview Pin
/*Trucker*\25-Aug-05 9:14
/*Trucker*\25-Aug-05 9:14 
AnswerRe: getting first root node of treeview Pin
David Crow25-Aug-05 9:29
David Crow25-Aug-05 9:29 
GeneralRe: getting first root node of treeview Pin
/*Trucker*\25-Aug-05 16:06
/*Trucker*\25-Aug-05 16:06 
GeneralRe: getting first root node of treeview Pin
David Crow26-Aug-05 2:41
David Crow26-Aug-05 2:41 
AnswerRe: getting first root node of treeview Pin
Jose Lamas Rios25-Aug-05 11:43
Jose Lamas Rios25-Aug-05 11:43 
GeneralRe: getting first root node of treeview Pin
/*Trucker*\25-Aug-05 16:15
/*Trucker*\25-Aug-05 16:15 
QuestionThreads Pin
Eytukan25-Aug-05 7:01
Eytukan25-Aug-05 7:01 
AnswerRe: Threads Pin
Jack Puppy25-Aug-05 7:20
Jack Puppy25-Aug-05 7:20 
AnswerRe: Threads Pin
David Crow25-Aug-05 7:46
David Crow25-Aug-05 7:46 
AnswerRe: Threads Pin
LighthouseJ25-Aug-05 17:03
LighthouseJ25-Aug-05 17:03 

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.