Modal dialog box in a Thread
-
Hi, I want to create a modal dialog box instead of a messagebox in a worker thread.But when I closed the dialog box the program is gone (shutting down). What can cause to this problem? Is there a way to create a modal dialog box in a thread? I think I shoud say that I am writing the program for Windows CE, but I think that the problem may be a general problem. Thanks
-
Hi, I want to create a modal dialog box instead of a messagebox in a worker thread.But when I closed the dialog box the program is gone (shutting down). What can cause to this problem? Is there a way to create a modal dialog box in a thread? I think I shoud say that I am writing the program for Windows CE, but I think that the problem may be a general problem. Thanks
-
Hi, I want to create a modal dialog box instead of a messagebox in a worker thread.But when I closed the dialog box the program is gone (shutting down). What can cause to this problem? Is there a way to create a modal dialog box in a thread? I think I shoud say that I am writing the program for Windows CE, but I think that the problem may be a general problem. Thanks
Don't create UI in your worker thread, send a message to your main UI thread and create a dialog there. use synchronisation event to wait for the dialog in your thread.
This signature was proudly tested on animals.
-
Don't create UI in your worker thread, send a message to your main UI thread and create a dialog there. use synchronisation event to wait for the dialog in your thread.
This signature was proudly tested on animals.
My code is like that;
UINT ComThreadEvent1(LPVOID lParam)
{
CNotepad *dlg = (CNotepad *)lParam;
while(HD != NULL)
{
::Sleep(500);
int index = dlg->events.Find(_T("\r\n"),0);
if(index == 0 )
{
dlg->thread2->ResumeThread();
dlg->GetEvent(dlg->events.Left(index));
}
}
return 0;
}void CNotepad::GetEvent(CString event)
{
CString str;
if(event.Mid(9,2) == "C0")
{
str = "Hello";
CMessageBox mBox;
mBox.DoModal();
}
}Here GetEvent() method is creating Modal Dialog box.How can I send a message to my main UI thread and create a dialog there? Thanks