worker thread communicate with user interface
-
-
hi, apart from using PostMessage(), i want to any method or example like callback function, or similar to delegate in C#. so that, worker thread able to communicate with user interface on a event. i want to learn more on this. any help? thanks! jim.
Hi, Have u tried PostThreadMessage() API , using this API u can post ur event message to ur worket thread. for e.g void yourFunction() { BOOL success = PostThreadMessage( idThread, your thread ID Msg, // message wParam, // first message parameter lParam // second message parameter ); } and in your Thread... DWORD WINAPI yourThreadProc(void *ptr) { MESSAGE msg; while(GetMessage(&msg,NULL, 0,0) { switch(msg.message) { ---do your work accordingly --- } } } Abhishek Srivastava Software Engineer (VC++) India ,Noida Mobile no 9891492921 :)