Windows and Threads
-
I have an application that creates several threads. One of these threads creates a (second) Window. When that thread goes away, the window it created goes away also. However, the pointer to the class that represents the window is still valid. It is never freed. I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this? Bob P.S. – I am under the impression that there is not.
-
I have an application that creates several threads. One of these threads creates a (second) Window. When that thread goes away, the window it created goes away also. However, the pointer to the class that represents the window is still valid. It is never freed. I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this? Bob P.S. – I am under the impression that there is not.
-
I have an application that creates several threads. One of these threads creates a (second) Window. When that thread goes away, the window it created goes away also. However, the pointer to the class that represents the window is still valid. It is never freed. I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this? Bob P.S. – I am under the impression that there is not.
BobInNJ wrote:
I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this?
No. The window requires its WndProc to be on the thread that created it. Each window's messages go via a message queue, which is a per-thread structure.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
BobInNJ wrote:
I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this?
No. The window requires its WndProc to be on the thread that created it. Each window's messages go via a message queue, which is a per-thread structure.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
BobInNJ wrote:
I would like the window to stay up when the thread that created it goes away. Is there a reasonable way to do this?
No. The window requires its WndProc to be on the thread that created it. Each window's messages go via a message queue, which is a per-thread structure.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Stuart, Isn't message queue an application level data structure that's common to all its threads?
The system maintains a single system message queue and one thread-specific message queue for each graphical user interface (GUI) thread. To avoid the overhead of creating a message queue for nonGUI threads, all threads are created initially without a message queue. The system creates a thread-specific message queue only when the thread makes its first call to one of the User or Windows Graphics Device Interface (GDI) functions.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
The system maintains a single system message queue and one thread-specific message queue for each graphical user interface (GUI) thread. To avoid the overhead of creating a message queue for nonGUI threads, all threads are created initially without a message queue. The system creates a thread-specific message queue only when the thread makes its first call to one of the User or Windows Graphics Device Interface (GDI) functions.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p