User32SendMessageTimeout(HandleRef, WindowMessages, IntPtr, String, SendMessageTimeoutFlags, Int32, IntPtr) Method

Sends the specified message to a window.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static IntPtr SendMessageTimeout(
	HandleRef hWnd,
	WindowMessages msg,
	IntPtr wParam,
	string lParam,
	SendMessageTimeoutFlags fuFlags,
	int uTimeout,
	out IntPtr refResult
)

Parameters

hWnd  HandleRef
A handle to the window whose window procedure will receive the message.

If 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.

msg  WindowMessages
The message to be sent.

For lists of the system-provided messages, see System-Defined Messages: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644927%28v=vs.85%29.aspx#system_defined

wParam  IntPtr
Any additional message-specific information.
lParam  String
Any additional message-specific information.
fuFlags  SendMessageTimeoutFlags
The behavior of this function.
uTimeout  Int32
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.

refResult  IntPtr
The result of the message processing.

The value of this parameter depends on the message that is specified.

Return Value

IntPtr
If the function succeeds, the return value is nonzero. If the function fails or times out, the return value is 0.

SendMessageTimeout(IntPtr, EditControlMessages, IntPtr, IntPtr, SendMessageTimeoutFlags, Int32, IntPtr) does not provide information about individual windows timing out if HWND_Broadcast is used.

To get extended error information, call GetLastWin32Error. If GetLastWin32Error returns ERROR_TIMEOUT, then the function timed out.

Remarks

See Also