SendMessage:
The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.
SendMessage函数将指定的消息发到窗口。它调用特定窗口的窗口处理函数,并且不会立即返回,直到窗口处理函数处理了这个消息。SendMessage只是调用我们的消息处理函数
LRESULT WINAPI SendMessage(
_In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam );
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, overlapped windows, and pop-up windows; but the message is not sent to child windows.窗口程序将接收消息的窗口的句柄。如果此参数为HWND_BROADCAST,则消息将被发送到系统中所有顶层窗口,包括无效或不可见的非自身拥有的窗口、被覆盖的窗口和弹出式窗口,但消息不被发送到子窗口。
Message sending is subject to UIPI. The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.消息发送属于UIPI(User Interface Privilege Isolation(用户界面特权隔离)
UIPI保护了高权限进程的界面和用户对象(User Object)不受到低权限恶意进程的更改。通常,一个进程权限的高低取决于它的Integrity Level (IL)。)要更加详细了解UIPI可去http://wenku.baidu.com/link?url=YpkH1-XZzr435JrgrZyDcP4kfNIJJYKSLN7drGIr9OgiPfL2p1bN83Ue-AakfU_fB1hB-w8WK52c2xnOutTWzE2WfDVbTtE2vvHhVV2PbFu 或者http://blog.csdn.net/chris820313/article/details/6706034)一个进程的线程能发送消息到进程中唯一的线程的消息队列
Type: UINT
The message to be sent.被发送的消息。
For lists of the system-provided messages, see System-Defined Messages.系统提供的消息列表可参见System-Defined Messages
Type: WPARAM
Additional message-specific information.指定附加的消息特定的信息。
Type: LPARAM
Additional message-specific information.
Return value
Type:
Type: LRESULT
The return value specifies the result of the message processing; it depends on the message sent.
返回值指定消息处理的结果,依赖于所发送的消息。PostMessage:
The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
PostMessage函数将一个消息放入与创建这个窗口的消息队列相关的线程中,并立刻返回不等待线程处理消息。PostMessage只是将消息放到消息队列中
Parameters
-
hWnd [in, optional]
-
Type: HWND
A handle to the window whose window procedure is to receive the message. The following values have special meanings.
其窗口程序接收消息的窗口的句柄。以下值具有特殊意义:
Value