网站首页  词典首页

请输入您要查询的函数:

 

术语 sendmessage
释义 SendMessage
语法:
LRESULT SendMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
SendMessage函数
指定的消息发送到一个窗口或窗口。 SendMessage函数调用指定窗口的窗口过程并不会返回,直到窗口程序处理的信息。
要发送信息,并立即返回,使用SendMessageCallback或SendNotifyMessage功能。若要张贴讯息,到线程的消息队列,并立即返回,使用使用PostMessage或PostThreadMessage功能。
参数
hWnd
[in]
句柄窗口的窗口过程将收到消息。如果此参数为HWND_BROADCAST,该消息被发送到所有顶级的系统级窗口,包括残疾或无形无主窗口,重叠的窗口和弹出窗口,但消息不是发送到子窗口。
微软Windows Vista和更高版本。消息发送是受用户界面特权隔离(UIPI)。一个进程的线程可以只发送邮件的线程消息队列在较低Level或等于完整过程。
消息
[in]指定要发送的信息。
wParam
[in]指定附加消息的特定信息。
lparam的
[in]指定附加消息的特定信息。
返回值
返回值指定消息处理的结果,它取决于发送邮件。
备注
微软Windows Vista和更高版本。当一条消息封锁UIPI最后一个错误,与GetLastError函数检索,设置为5(拒绝访问)。
应用程序需要使用HWND_BROADCAST通信应使用RegisterWindowMessage函数获取间独特的信息,应用程序通信。
该系统不仅为系统消息编组(范围为0至(WM_USER -1))的。其他消息发送(即“= WM_USER)到另一个进程,则必须自定义编组。
如果指定的窗口是由调用线程创建的窗口过程立即调用一个子程序。如果指定的窗口是由不同的线程创建的,系统切换到该线程并调用适当的窗口过程。线程之间发送的邮件处理只有在接收线程执行消息检索代码。发送线程被阻塞,直到接收线程处理消息。然而,发送线程将处理传入nonqueued信息,同时为它的消息等待处理。为了避免这种情况,与SMTO_BLOCK使用SendMessageTimeout集。欲了解更多有关nonqueued消息的详细信息,请参阅Nonqueued邮件。
在Windows 95/98/Me:SendMessageW是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
例如
有关示例,请参见显示键盘输入。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
消息和消息队列概述,InSendMessage,PostMessage,PostThreadMessage,RegisterWindowMessage,SendDlgItemMessage,SendMessageCallback,SendMessageTimeout,SendNotifyMessage
==英文原文==SendMessage Function
Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.
Syntax
LRESULT SendMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
Parameters
hWnd
[in]
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, overlapped windows, and pop-up windows; but the message is not sent to child windows.
Microsoft Windows Vista and later. Message sending is subject to User Interface Privilege Isolation (UIPI). The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.
Msg
[in] Specifies the message to be sent.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
Return Value
The return value specifies the result of the message processing; it depends on the message sent.
Remarks
Microsoft Windows Vista and later. When a message is blocked by UIPI the last error, retrieved with GetLastError , is set to 5 (access denied).
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.
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.
If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message. However, the sending thread will process incoming nonqueued messages while waiting for its message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more information on nonqueued messages, see Nonqueued Messages .
Windows 95/98/Me: SendMessageW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
Example
For an example, see Displaying Keyboard Input .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.
See Also
Messages and Message Queues Overview , InSendMessage , PostMessage , PostThreadMessage , RegisterWindowMessage , SendDlgItemMessage , SendMessageCallback , SendMessageTimeout , SendNotifyMessage
==原始网址==http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:22:59