Jump to content
  • Advertisement
Sign in to follow this  
Endurion

WSAAsyncEvent and MFC/Threads, no events?

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, i stumbled upon a weird problem, and there's probably an easy solution: I have a socket server and client class, which works very nice so far. They both derive from a basic socket handler class, which creates an invisible window to get the events (thus no need to have a thread constantly polling). This also works nice and dandy. Now i was trying to use that class in an MFC app. This didn't work, the invisible window didn't receive any notification messages. It actually seems like the message pump ignores that window (or the messages are redirected somewhere). Traces showed that only the initial NCCREATE and followups were processed by the window proc. Upon investigating i made a test case which would simply create another instance of that class and test send some data, and that worked fine. The difference i noticed: In the non working case, the invisible window was created during a call in a thread (not the main thread). The working case created that window inside the apps main thread. What did i do wrong? Or is there a special way to create a window like that for MFC? I couldn't find anything in the docs that told about thread problems. -My solution for now: I create the invisible window beforehand, from the main apps thread, and it works that way, even when the socket is created from another thread.

Share this post


Link to post
Share on other sites
Advertisement
This is a Windows programming question. In general, windows will get messages in the thread they were created in. More about windows messages and threads can be found on MSDN.

Share this post


Link to post
Share on other sites

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!