LRESULT SendMessageTimeout(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
UINT fuFlags,
UINT uTimeout,
PDWORD_PTR lpdwResult
);
hWnd
- [in] Handle to the window whose window procedure will receive the message.
MsgIf this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows. The function does not return until each window has timed out. Therefore, the total wait time can be up to the value of uTimeout multiplied by the number of top-level windows.
- [in] Specifies the message to be sent.
wParam- [in] Specifies additional message-specific information.
lParam- [in] Specifies additional message-specific information.
fuFlags- [in] Specifies how to send the message. This parameter can be one or more of the following values.
uTimeout
SMTO_ABORTIFHUNG
- Returns without waiting for the time-out period to elapse if the receiving thread appears to not respond or "hangs."
SMTO_BLOCK
- Prevents the calling thread from processing any other requests until the function returns.
SMTO_NORMAL
- The calling thread is not prevented from processing other requests while waiting for the function to return.
SMTO_NOTIMEOUTIFNOTHUNG
- Microsoft Windows 2000/Windows XP: Do not enforce the time-out period as long as the receiving thread is processing messages.
SMTO_ERRORONEXIT
- [in] Specifies the duration, in milliseconds, of the time-out period. If the message is a broadcast message, each window can use the full time-out period. For example, if you specify a five second time-out period and there are three top-level windows that fail to process the message, you could have up to a 15 second delay.
lpdwResult- [out] Receives the result of the message processing. This value depends on the message sent.
Return Value
If the function succeeds, the return value is nonzero. SendMessageTimeout does not provide information about individual windows timing out if HWND_BROADCAST is used.
If the function fails or times out, the return value is zero. To get extended error information, call GetLastError. If GetLastError returns ERROR_TIMEOUT, then the function timed out.
Microsoft Windows 2000: If GetLastError returns zero, then the function timed out.