Re: Modal dialog as thread
You could make CSomeDialog dlg a member of the CDialogThread class.
Then if another thread needs to update the dialog, that object can be used
with PostMessage() to post a user-defined message to the dialog telling it
to update its text.
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
"Rami" <rami@intern.net> wrote in message
news:OktKc2JIIHA.4712@TK2MSFTNGP04.phx.gbl...
The following 3 step procedure was taken form CodeGuru article named
Convert modal dialogs to modeless by Jon S. Kyle
It works greate but I can't figure out how to modify controls text on the
dialog box while its already diplayed.
Can someone advise please?
Rami
1. In your header file define a CWinThread-derived class...
class CDialogThread : public CWinThread
{
DECLARE_DYNCREATE(CDialogThread)
CDialogThread() {};
virtual BOOL InitInstance();
};
2. Put this in your implementation file (where CSomeDialog is a
conventional dialog class defined the usual way).
IMPLEMENT_DYNCREATE(CDialogThread, CWinThread)
BOOL CDialogThread::InitInstance()
{
CSomeDialog dlg;
dlg.DoModal();
return FALSE;
}
3. To create an instance of your (now-modeless) modal dialog, do this...
AfxBeginThread ( RUNTIME_CLASS(CDialogThread) );