An interesting problem
-
I create a thread in a very simple app, that way:
HWND hWnd = CreateWindow(...); DWORD _tid; if((CreateThread(NULL, 0, msgprocessing, hWnd, 0, &_tid)) == NULL) { error(); } // hWnd is the parameter for thread
I need tu run message processing in the thread to catch msg's for hWnd window, but it won't work. Everything else is coded correctly. Any ideas why :confused: -
I create a thread in a very simple app, that way:
HWND hWnd = CreateWindow(...); DWORD _tid; if((CreateThread(NULL, 0, msgprocessing, hWnd, 0, &_tid)) == NULL) { error(); } // hWnd is the parameter for thread
I need tu run message processing in the thread to catch msg's for hWnd window, but it won't work. Everything else is coded correctly. Any ideas why :confused: -
Hi, have you tried to create the window in the thread that needs to catch the messages? This should work.
codito ergo sum
Hi, U can create window in thread. The message of that window will pass though the PreTransalte and MessageLoop of the application . If needed i hope u can implement you own message loop(in the thread itself) after the creation of window. I do not know if the implementation of message loop in the thread will causue any problem withe the main message loop of the application. Prasanth Vijay
-
Hi, U can create window in thread. The message of that window will pass though the PreTransalte and MessageLoop of the application . If needed i hope u can implement you own message loop(in the thread itself) after the creation of window. I do not know if the implementation of message loop in the thread will causue any problem withe the main message loop of the application. Prasanth Vijay
U can use PeekMessage() message for implementing the message catching loop. See the help in MSDN. If u have time, Plz have look on CWInApp::Run() or CWinThread::Run() in the MFC message implementation. This will give very good idea on the messaeg loop implemenattion. Thanks Prasanth Vijay
-
U can use PeekMessage() message for implementing the message catching loop. See the help in MSDN. If u have time, Plz have look on CWInApp::Run() or CWinThread::Run() in the MFC message implementation. This will give very good idea on the messaeg loop implemenattion. Thanks Prasanth Vijay
I used the PeekMessage and tried to create the window in the secondary thread, but still not working. So I placed the whole code, here (sorry for the comments, they are not in ENG)