c++ - Does a win32 application have one message loop? Or is it one message loop per window? -
i'm little bit confused how message loops work in win32 programming. in winmain
put following:
while ( getmessage ( &msg, null, 0, 0 ) > 0 ) { translatemessage ( &msg ); dispatchmessage ( &msg ); }
this while loop pretty runs until application stops. mean have 1 message loop per application rather per window?
from about messages , message queues:
applications multiple threads can include message loop in each thread creates window.
note messsage queue can support multiple windows... second parameter of getmessage
handle of window want watch messages for. if null
windows of thread.
as second note, possible create message queue without windows (at least windows 2000 onward). described in documentation postthreadmessage
:
in thread message posted, call
peekmessage
shown here force system create message queue.
peekmessage(&msg, null, wm_user, wm_user, pm_noremove)
Comments
Post a Comment