Windows messages and their deterministic properties -
i'd confirm think true. when use windows sendmessage()
, deterministic call in execute (will not return until message processed) opposed postmessage()
non-deterministic can preempted other message happens in queue @ moment in time (in fact not executed until hits message loop).
is fair assessment, or missing something?
that true in-process calls. cross-process sendmessage works similar, processing of message doesn't begin until receiver process calls getmessage (or kin).
your ui thread has message pump looks like:
while (getmessage(&msg)) dispatchmessage(&msg);
postmessage causes message put onto message queue. getmessage removes oldest message queue (fifo*).
dispatchmessage causes wndproc associated message's target window called message.
sendmessage bypasses chain , calls wndproc directly (more or less).
a lot of standard window messages result in chain of sendmessage calls sending 1 message sends sends another. chain referred "the current dispatch". if need message processed inside chain, use sendmessage. if need processed after current dispatch has completed, use postmessage.
you can use tool spy++ see windows messaging in action, or debug problems you're having message order of operations.
[*] it's not strictly fifo queue because kinds of messages (i.e. timer, mouse, keyboard) not posted queue, rather generated on fly. sake of simplicity, can think of fifo.