THreads
-
-
I have an app with 2 threads that run in background. Now I want to communicate between these threads. I know PostMessage would help ME. But I want to send a message from thread1 to therad 2 Pls help me with code snippet. Regards YKUTTANUR Chintu
-
I have an app with 2 threads that run in background. Now I want to communicate between these threads. I know PostMessage would help ME. But I want to send a message from thread1 to therad 2 Pls help me with code snippet. Regards YKUTTANUR Chintu
ykutanoor wrote: I know PostMessage would help ME. But I want to send a message from thread1 to therad 2 Pls help me with code snippet. are you looking for PostThreadMessage(...)
God is Real, unless declared Integer.
-
I have an app with 2 threads that run in background. Now I want to communicate between these threads. I know PostMessage would help ME. But I want to send a message from thread1 to therad 2 Pls help me with code snippet. Regards YKUTTANUR Chintu
1. Put this code in both the thread code that is required for the Examining a Message Queue that is associated with a particaular thread. BOOL fDone; MSG msg; // Begin the operation and continue until it is complete fDone = FALSE; while (!fDone) { fDone = DoLengthyOperation(); // application-defined function // Remove any messages that may be in the queue. If the // queue contains any mouse or keyboard // messages, end the operation. while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { switch(msg.message) { case WM_USER1: case WM_USER2: // // Perform any required cleanup. // fDone = TRUE; } } } 2. Use the PostThreadMessage(....) API for posting the messages between threads. Jitendra