Applies to: desktop apps only
Sends the specified message to one or more windows.
Syntax
LRESULT WINAPI SendMessageTimeout( __in HWND hWnd, __in UINT Msg, __in WPARAM wParam, __in LPARAM lParam, __in UINT fuFlags, __in UINT uTimeout, __out_opt PDWORD_PTR lpdwResult );
Parameters
- hWnd [in]
-
Type: HWND
A handle to the window whose window procedure will receive the message.
If this parameter is HWND_BROADCAST ((HWND)0xffff), 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.
- Msg [in]
-
Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
- wParam [in]
-
Type: WPARAM
Any additional message-specific information.
- lParam [in]
-
Type: LPARAM
Any additional message-specific information.
- fuFlags [in]
-
Type: UINT
The behavior of this function. This parameter can be one or more of the following values.
- uTimeout [in]
-
Type: UINT
The duration of the time-out period, in milliseconds. 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, optional]
-
Type: PDWORD_PTR
The result of the message processing. The value of this parameter depends on the message that is specified.
Return value
Type:
Type: LRESULT
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 0. To get extended error information, call GetLastError. If GetLastError returns ERROR_TIMEOUT, then the function timed out.
Windows 2000: If GetLastError returns 0, then the function timed out.
Remarks
The function calls the window procedure for the specified window and, if the specified window belongs to a different thread, does not return until the window procedure has processed the message or the specified time-out period has elapsed. If the window receiving the message belongs to the same queue as the current thread, the window procedure is called directly—the time-out value is ignored.
This function considers that a thread is not responding if it has not called GetMessage or a similar function within five seconds.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other messages (those >= WM_USER) to another process, you must do custom marshalling.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | SendMessageTimeoutW (Unicode) and SendMessageTimeoutA (ANSI) |
See also
- Reference
- GetMessage
- InSendMessage
- PostMessage
- SendDlgItemMessage
- SendMessage
- SendMessageCallback
- SendNotifyMessage
- Conceptual
- Messages and Message Queues
Send comments about this topic to Microsoft
Build date: 2/3/2012
IN
(CALL OF DUTY WAW) THE PEAPOL THAT THEAY PLAY THIS GAME ALL OF THEAM HACKERS ANA I HOPE THAT YOU CAN MACKE AN UPDAIT PLEAS
THANK YOU .....
SMTO_ERRORONEXIT:
ATTENTION: This falg is available only on Windows Vista and higher.
If you use SMTO_ERRORONEXIT on Windows XP SP3 or older, SendMessageTimeout will return ERROR_INVALID_PARAMETER
The uTimeout argument is declared as UINT, but it seems to actually be an INT internally, because timeouts larger than MAXINT (0x7fffffff, or a timeout of over 24 years and 10 months) are treated like 0. Bottom line, you can't use INFINITE for uTimeout (tested on Windows Vista). 24 years and 10 months (MAXINT) should be infinite enough for most purposes, tough