Re: Help with user interaction with worker thread
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Sun, 29 Jan 2006 22:42:46 -0600
On Mon, 30 Jan 2006 09:26:42 +0530, "Vipin [MVP]" <Vipin@xxxxxxxxxx> wrote:
>You should use events in this situation:-
>
>if( myWorkerClass.DoCommand1( ) != PASS)
> {
> HANDLE hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
> ::PostMessage(m_hWnd,AM_CMD1_FAILED,0,0);
> WaitForSingleObject(hEvent , INFINITE);
> CloseEvent(hEvent);
> }
>
>What I would do is then package the hEvent in the parameter passed in to the
>GUI thread, in your case if it is "view".
>I would do view->m_hEvent = hEvent; after creating the event or package this
>in the wParam or lParam
>of the PostMessage.
>
>Then in the GUI thread after the user has been prompted and shown the
>MessageBox, when he click "ok"
>Set the event to signaled state, so the worker thread can continue from that
>point.
It would be simpler just to use SendMessage...
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: Help with user interaction with worker thread
- From: Alexander Grigoriev
- Re: Help with user interaction with worker thread
- References:
- Help with user interaction with worker thread
- From: Danny
- Re: Help with user interaction with worker thread
- From: Vipin [MVP]
- Help with user interaction with worker thread
- Prev by Date: Re: Help with user interaction with worker thread
- Next by Date: Re: Help with user interaction with worker thread
- Previous by thread: Re: Help with user interaction with worker thread
- Next by thread: Re: Help with user interaction with worker thread
- Index(es):