- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure? That is an unusual threading arrangement, one that I imagine if you didn't get right then all sorts of wierd and wonderful things could start happening.
Typically you would have one thread that handles all your user interface interaction - it creates all windows, receives all user input messages (runs the message loop), does all significant manipulation of those windows and ultimately destroys all those windows. In response to user input, worker threads are be created (or existing worker threads are tasked) to carrying out lengthy calculations that might otherwise prevent the user from being able to interact with your application.
Dialog boxes and other user interface elements often need to notify their parent and owner windows about changes in their state (messages to say "someone clicked on me", "I've been (de)activated", "I've been moved", etc). If the thread that handles input for that window is busy doing calculations then it can't handle those notifications, and the dialog box will either stop responding or start behaving badly (as all children are wont to do when the folks aren't paying attention).
There are a number of options for how worker threads can communicate with the UI thread. Whatever you choose, avoid having threads other than the one that initially created a window from directly manipulating the window. Leave all user interface stuff to the user interface thread.
Even if you could merrily do cross thread manipulation of windows, there's no point having multiple threads just processing user interface events, because users simply aren't that quick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are creating modal dialog boxes? The windows api calls that create modal dialog boxes (such as GetOpenFileName) have their own internal message loop. I don't understand why this internal loop wouldn't continue to dispatch messages (other than input messages - the owner window is disabled by design) to your main window. It might be unrelated, but the fact that you have to create threads just to get dialog boxes to work makes me suspicious.
What does GetLastError say after the call to CreateThread?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page