网站首页  词典首页

请输入您要查询的函数:

 

术语 postmessage
释义 PostMessage
语法:
BOOL PostMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
PostMessage函数
PostMessage函数的地方(职位)在与该线程创建的线程不必等待处理该消息指定的窗口,并返回相关的消息队列消息。
后与线程相关的消息队列的消息,请使用PostThreadMessage函数。
参数
hWnd
[in]
微软Windows Vista和更高版本。消息的发布是受用户界面特权隔离(UIPI)。一个进程的线程才能张贴讯息只能消息队列的线程在较低Level或等于完整过程。
句柄窗口的窗口过程是接收消息。下面的值具有特殊的意义。
HWND_BROADCAST
该消息被发送到所有顶级的系统级窗口,包括残疾或无形无主窗口,重叠的窗口和弹出窗口。该消息是不会发布到子窗口。

该函数的行为就像一个设置为当前线程标识符dwThreadId参数调用PostThreadMessage。
消息
[in]指定的邮件被公布。
wParam
[in]指定附加消息的特定信息。
lparam的
[in]指定附加消息的特定信息。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
微软Windows Vista和更高版本。当一条消息封锁UIPI最后一个错误,与GetLastError函数检索,设置为5(拒绝访问)。
在邮件队列中的邮件被检索到GetMessage或PeekMessage函数调用。
应用程序需要使用HWND_BROADCAST通信应使用RegisterWindowMessage函数获取间独特的信息,应用程序通信。
该系统不仅为系统消息编组(范围为0至(WM_USER -1))的。其他消息发送(即“= WM_USER)到另一个进程,则必须自定义编组。
如果您要发送以下WM_USER的异步消息函数(PostMessage,SendNotifyMessage和SendMessageCallback)范围内的信息,它的消息参数不能包含指针。否则,操作将失败。该函数将返回之前接收线程有机会来处理信息,发送方将释放内存才能使用。
不要张贴WM_QUIT消息使用PostMessage;使用PostQuitMessage函数。
有一种万限制每封邮件信息发布队列。这个限制应足够大。如果您的申请一旦超过限额,应重新设计,以避免消耗太多的系统资源。若要调整此限制,修改以下注册表项。
HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit
可接受的最低值为4000。
在Windows 95/98/Me:PostMessageW是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
实例
下面的示例显示了如何张贴私人窗口消息使用PostMessage函数。假设您定义了一个私人窗口消息称WM_COMPLETE:
#define WM_COMPLETE (WM_USER + 0)

您可以张贴消息到消息队列与线程创建如下所示指定的窗口进行相关的:
WaitForSingleObject(pparams,“hEvent,无限);
lTime = GetCurrentTime();
PostMessage(pparams -“的HWND,WM_COMPLETE,0,lTime);
更多的例子,请参阅启动一个数据链接。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
消息和消息队列概述,GetMessage,PeekMessage,PostQuitMessage,PostThreadMessage,RegisterWindowMessage,SendMessageCallback,SendNotifyMessage
==英文原文==PostMessage Function
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.
To post a message in the message queue associated with a thread, use the PostThreadMessage function.
Syntax
BOOL PostMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
Parameters
hWnd
[in]
Microsoft Windows Vista and later. Message posting is subject to User Interface Privilege Isolation (UIPI). The thread of a process can post messages only to message queues of threads in processes of lesser or equal integrity level.
Handle to the window whose window procedure is to receive the message. The following values have special meanings.
HWND_BROADCAST
The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.
NULL
The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.
Msg
[in] Specifies the message to be posted.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
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).
Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.
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 you send a message in the range below WM_USER to the asynchronous message functions (PostMessage, SendNotifyMessage , and SendMessageCallback ), its message parameters cannot include pointers. Otherwise, the operation will fail. The functions will return before the receiving thread has had a chance to process the message and the sender will free the memory before it is used.
Do not post the WM_QUIT message using PostMessage; use the PostQuitMessage function.
There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust this limit, modify the following registry key.
HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit
The minimum acceptable value is 4000.
Windows 95/98/Me: PostMessageW 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 .
Examples
The following example shows how to post a private window message using the PostMessage function. Assume you defined a private window message called WM_COMPLETE:
#define WM_COMPLETE (WM_USER + 0)
You can post a message to the message queue associated with the thread that created the specified window as shown below:
WaitForSingleObject (pparams->hEvent, INFINITE) ;
lTime = GetCurrentTime () ;
PostMessage (pparams->hwnd, WM_COMPLETE, 0, lTime);
For more examples, see Initiating a Data Link .
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 , GetMessage , PeekMessage , PostQuitMessage , PostThreadMessage , RegisterWindowMessage , SendMessageCallback , SendNotifyMessage
==原始网址==http://msdn.microsoft.com/en-us/library/ms644944(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 13:20:43