User32PostThreadMessage(Int32, Int32, IntPtr, IntPtr) Method

Places (posts) a message to the message queue of the specified thread.

It returns without waiting for the thread to process the message.

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", SetLastError = true)]
public static bool PostThreadMessage(
	int threadId,
	int message,
	IntPtr wparam,
	IntPtr lparam
)

Parameters

threadId  Int32
The identifier of the thread to which the message is to be posted.

The function fails if the specified thread does not have a message queue. The system creates a thread's message queue when the thread makes its first call to one of the User or GDI functions.

Message posting is subject to UIPI. The thread of a process can post messages only to posted-message queues of threads in processes of lesser or equal integrity level.

This thread must have the SE_TCB_NAME privilege to post a message to a thread that belongs to a process with the same locally unique identifier (LUID) but is in a different desktop. Otherwise, the function fails and returns ERROR_INVALID_THREAD_ID.

message  Int32
The type of message to be posted.
wparam  IntPtr
Specifies additional message-specific information.
lparam  IntPtr
Specifies additional message-specific information.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also