**TheStig**
July 16th, 2007, 08:09 PM
This is probably a question a newbie worthy.. Which seems appropriate..
I have created a thread by using _beginthreadex. This new thread (lets call it mother) has a callback function which seems to work just fine. However, this thread (mother) requires a window to show and handle some UI. The thread creates a window (lets call it child) using CreateWindowEx which has its own callback function.
The problem is that the window (child) is not responding to anything. Simple moving around/resizing is not happening. I realize that using two threads "on top of" each other for showing a simple window seems complicated, which it is. I am trying to simplify the code structure all the time.
Back to the core problem. Why is the window (child) not responding? I have put in trace events to verify that the window (child) callback is really being called, which it seems to be. The problem is when I try to send messages from "mother" by using the HWND (as obtained from the call to _beginthreadex), the message seems stuck in the mother thread. It is captured in mother, not in the child callback. Well, not instantly at least. It comes through after a while (but mother could have had several hundred hits already). The CPU is struggling, and I have to force the app to a shutdown/stop.
Message handling is done in Mother's callback. I have a timer event which spins through PeekMessage and calls TranslateMessage/DispatchMessage.
This entire problem could be based on poor design, but it should work, should'nt it?
Any ideas? Hopeless case?
I have created a thread by using _beginthreadex. This new thread (lets call it mother) has a callback function which seems to work just fine. However, this thread (mother) requires a window to show and handle some UI. The thread creates a window (lets call it child) using CreateWindowEx which has its own callback function.
The problem is that the window (child) is not responding to anything. Simple moving around/resizing is not happening. I realize that using two threads "on top of" each other for showing a simple window seems complicated, which it is. I am trying to simplify the code structure all the time.
Back to the core problem. Why is the window (child) not responding? I have put in trace events to verify that the window (child) callback is really being called, which it seems to be. The problem is when I try to send messages from "mother" by using the HWND (as obtained from the call to _beginthreadex), the message seems stuck in the mother thread. It is captured in mother, not in the child callback. Well, not instantly at least. It comes through after a while (but mother could have had several hundred hits already). The CPU is struggling, and I have to force the app to a shutdown/stop.
Message handling is done in Mother's callback. I have a timer event which spins through PeekMessage and calls TranslateMessage/DispatchMessage.
This entire problem could be based on poor design, but it should work, should'nt it?
Any ideas? Hopeless case?