who will create the message loop and message queue?
-
in win32, where will keep the all messages are generated by the window? and how do know this message is belongs to this window? and who will maintain the message queue? what happand in background? what is the code in c++? what are the methods are fallows in background?
Regards, Srinivas
-
in win32, where will keep the all messages are generated by the window? and how do know this message is belongs to this window? and who will maintain the message queue? what happand in background? what is the code in c++? what are the methods are fallows in background?
Regards, Srinivas
Every thread has its own message queue that is setup by the system into which it posts the messages. Now that you have a start, dig into MSDN.
...byte till it megahertz... my donation to web rubbish
-
in win32, where will keep the all messages are generated by the window? and how do know this message is belongs to this window? and who will maintain the message queue? what happand in background? what is the code in c++? what are the methods are fallows in background?
Regards, Srinivas
There are lots of things to say about your question. Let's say:
- the operating system handle a message queue for each thread in your process;
- it's up to you to write down the message loop for each thread
- each time you call the
DispatchMessage
from your message loop, the message is dispatched to the window procedure of the window to which the message is targeted
To learn about this topic, start from Messages and Message Queues (Windows)[^]
-
Every thread has its own message queue that is setup by the system into which it posts the messages. Now that you have a start, dig into MSDN.
...byte till it megahertz... my donation to web rubbish
bleedingfingers wrote:
Every thread has its own message queue that is setup by the system into which it posts the messages.
That's not completely true, see The Old New Thing - In pursuit of the message queue. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
bleedingfingers wrote:
Every thread has its own message queue that is setup by the system into which it posts the messages.
That's not completely true, see The Old New Thing - In pursuit of the message queue. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
bleedingfingers wrote: Every thread has its own message queue that is setup by the system into which it posts the messages. That's not completely true, see The Old New Thing - In pursuit of the message queue.
I know I know. And one would have to use PeekMessage(...) to force a queue to be created but I just gave him a start. Now, let him wipe that e-dust off his MSDN will ya ;)
...byte till it megahertz... my donation to web rubbish
-
CPallini wrote:
bleedingfingers wrote: Every thread has its own message queue that is setup by the system into which it posts the messages. That's not completely true, see The Old New Thing - In pursuit of the message queue.
I know I know. And one would have to use PeekMessage(...) to force a queue to be created but I just gave him a start. Now, let him wipe that e-dust off his MSDN will ya ;)
...byte till it megahertz... my donation to web rubbish
[Edit] I overlooked it - A 5 vote is offered. :) [/Edit]
There are some really weird people on this planet - MIM.
modified on Monday, October 18, 2010 1:52 PM
-
There are lots of things to say about your question. Let's say:
- the operating system handle a message queue for each thread in your process;
- it's up to you to write down the message loop for each thread
- each time you call the
DispatchMessage
from your message loop, the message is dispatched to the window procedure of the window to which the message is targeted
To learn about this topic, start from Messages and Message Queues (Windows)[^]
-
who will create a thread and message queue? what relation ship between operating system, thread, message queue, and application?
Regards, Srinivas
vasu_sri wrote:
who will create a thread and message queue?
The first thread is created by the operating system when you start an application. Other threads will be created by the application itself, for example by calling the CreateThread Function (Windows)[^]. A message queue is created and maintained by the operating system; the OS creates it only when needed, i.e. when your thread creates a window or calls any function that involves message queues.
vasu_sri wrote:
what relation ship between operating system, thread, message queue, and application?
It's a very generic question, and answer it requires thousands of words... Have you had a look at the documentation on MSDN that I suggested you?