Article ID: 106716
Article Last Modified on 7/11/2005
<WindowProc for window Win1>
...
case <xxx>:
...
SendMessageTimeout( hWnd2, // window handle
WM_USER+1, // message to send
wParam, // first message parameter
lParam, // second message parameter
SMTO_NORMAL, // flag *
100, // timeout (in milliseconds)
&ret ); // return value
...
break;
case WM_USER+2:
<time-consuming procedure>
break;
* Note that the SMTO_NORMAL flag indicates that the calling thread can
process other requests while waiting for the API to return.
<WindowProc for window Win2>
...
case WM_USER+1:
...
SendMessage( hWnd1, // window handle
WM_USER+2, // message to send
wParam, // first message parameter
lParam ); // second message parameter
OtherStuff();
...
break;
If Win1 executes this SendMessageTimeout() and Win2 uses SendMessage() to
send a message to Win1, Win1 can process the message because SMTO_NORMAL
was specified. If the SendMessageTimeout() expires while the execution is
currently in the window procedure for Win1, the state of the system will
depend on who owns the windows.
Keywords: kbhowto kbwndw KB106716