PostMessage

PostMessage, PostMessageBynum, PostMessageBystring

VB声明

Declare Function PostMessage& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)

Declare Function PostMessageByNum& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)

Declare Function PostMessageByString& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String)

说明

将一条消息投递到指定窗口的消息队列。投递的消息会在Windows事件处理过程中得到处理。在那个时候,会随同投递的消息调用指定窗口的窗口函数。特别适合那些不需要立即处理的窗口消息的发送

返回值

Long,如消息投递成功,则返回TRUE(非零)。会设置GetLastError

参数表

参数

类型及说明

hwnd

Long,接收消息的那个窗口的句柄。如设为HWND_BROADCAST,表示投递给系统中的所有顶级窗口。如设为零,表示投递一条线程消息(参考PostThreadMessage

wMsg

Long,消息标识符

wParam

Long,具体由消息决定

lParam

Any,具体由消息决定

Top