I don't know if this applies to you, but it sounds like it... SetWindowText
eventually results in a WM_SETTEXT message being sent to the window. If the
SendMessage is coming from a different thread, the thread that created the
window (the one receiving the message) must be processing messages.
Otherwise, the SetWindowText/SendMessage blocks.
I'm a little unclear on which thread is doing the waiting, but if it's the
one that created the window, it makes sense - any message sent to the window
from a different thread will be blocked. What you probably want to do
instead of WaitForSingleObject is to use MsgWaitForMultipleObjects (with
your single object) so you can process messages while you wait. I can
elaborate on how to do that if you'd like...
--
Jay Nabonne
It wouldn't shock me if SetWindowText() were to send a WM_SETTEXT message to
the thread that owns the window in question. If that is so, the receiver
_must_ be in a position to pump messages. Which is to say that threads that
own windows are never to block for very long. When they do, applications
that send them messages hang.
Regards,
Will
Yep, it's the one that created the window that is doing the waiting;
SendMessage will wait until the message pump does its thing again.
Another possibility (one I've not researched) is that SendMessage waits for
this to occur *or* the thread entering an alertable wait state. It'd be
interesting to try doing a WaitforSingleObjectEx call with alerts turned on
(and appropriate looping of the Wait call), to see if the SendMessage can
use an APC call to get its stuff done :)
Si