网站首页  词典首页

请输入您要查询的函数:

 

术语 peekmessage
释义 PeekMessage
语法:
BOOL PeekMessage( LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);
PeekMessage函数
PeekMessage函数调度的传入发送的邮件,检查贴出一个消息线程消息队列,并检索信息(如果存在)。
参数
lpMsg
[out]指向一个MSG结构接收邮件信息。
hWnd
[in]句柄窗口的消息要检索。窗口必须属于当前线程。
如果hWnd为NULL,PeekMessage撷取任何窗口属于当前线程的信息,并就当前线程的消息队列的任何消息,其hWnd值为NULL(见MSG结构)。因此,如果hWnd为NULL,既窗口消息和线程的邮件处理。
如果hWnd为-1,PeekMessage获取当前线程的消息队列的消息,其唯一的hWnd值为NULL,即线程消息由PostMessage张贴(当hWnd参数为NULL)或PostThreadMessage。
wMsgFilterMin
[in]指定第一条消息的价值范围内的信息进行审查。使用WM_KEYFIRST指定第一个键盘消息,或WM_MOUSEFIRST指定第一个鼠标消息。
如果wMsgFilterMin和wMsgFilterMax均为零,PeekMessage返回所有可用的信息(即不进行筛选范围)。
wMsgFilterMax
[in]指定的最后一个消息值范围内的信息进行审查。使用WM_KEYLAST指定最后键盘信息或WM_MOUSELAST指定最后鼠标消息。
如果wMsgFilterMin和wMsgFilterMax均为零,PeekMessage返回所有可用的信息(即不进行筛选范围)。
wRemoveMsg
[in]指定消息如何处理。此参数可以是下列值之一。
PM_NOREMOVE
消息未能从后加工PeekMessage队列。
PM_REMOVE
邮件被删除后从加工PeekMessage队列。
您可以选择结合起来,要么PM_NOREMOVE或者PM_REMOVE PM_NOYIELD值。此标志阻止释放任何线程正在等待调用该系统进入空闲状态(见WaitForInputIdle)。
默认情况下,所有的消息类型处理。要指定只有特定的信息应该是处理,指定一个或多个下列值。
PM_QS_INPUT
Windows 98/Me中时,Windows 2000/XP的:进程鼠标和键盘消息。
PM_QS_PAINT
Windows 98/Me中时,Windows 2000/XP的:进程涂料信息。
PM_QS_POSTMESSAGE
Windows 98/Me中时,Windows 2000/XP的:所有发布的信息流程,包括计时器和热键。
PM_QS_SENDMESSAGE
Windows 98/Me中时,Windows 2000/XP的:处理所有发送的邮件。
返回值
如果邮件是可用的,返回非零值。
如果没有可用的信息,返回值是零。
备注
PeekMessage与检索的hWnd参数或由IsChild函数指定其子女的任何确定的窗口相关的信息,并在由wMsgFilterMin和wMsgFilterMax参数给定的消息值的范围。请注意,应用程序只能使用在wMsgFilterMin和wMsgFilterMax参数的低位字,高位字是为系统保留。
请注意,PeekMessage总是检索WM_QUIT消息,无论哪个值指定为wMsgFilterMin和wMsgFilterMax。
在此呼吁,该系统能够等待,nonqueued消息,就是发送到由调用使用SendMessage消息,SendMessageCallback,SendMessageTimeout,或SendNotifyMessage功能线程拥有的窗口。然后第一个排队的消息相匹配指定的过滤器检索。该系统也可处理内部事件。如果没有指定过滤器,邮件处理,按以下顺序:
发送的邮件
发布信息
输入(硬件)信息和系统的内部事件
发送的邮件(再次)
WM_PAINT消息
WM_TIMER消息
要检索发布消息之前,输入信息,使用wMsgFilterMin和wMsgFilterMax参数。
该PeekMessage函数通常不从队列中删除WM_PAINT消息。 WM_PAINT消息留在队列中,直到它们被处理。但是,如果WM_PAINT消息有一个NULL更新区域,PeekMessage并从队列中删除它。
Windows XP:如果顶层窗口停止响应的邮件超过几秒钟,系统会考虑将窗口没有响应,代之以一个幽灵窗口具有相同的z顺序,位置,大小它,视觉属性。这允许用户将其移动,调整大小,甚至关闭该应用程序。然而,这些行动是唯一可用,因为该应用程序实际上是没有响应。当一个应用程序正在被调试,系统不会生成映像窗口。
在Windows 95/98/Me:PeekMessageW是支持的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版本。
参见
消息和消息队列,GetMessage,IsChild,味精,WaitForInputIdle,WaitMessage
==英文原文==PeekMessage Function
The PeekMessage function dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).
Syntax
BOOL PeekMessage( LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);
Parameters
lpMsg
[out] Pointer to an MSG structure that receives message information.
hWnd
[in] Handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL, PeekMessage retrieves messages for any window that belongs to the current thread, and any messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure). Therefore if hWnd is NULL, both window messages and thread messages are processed.
If hWnd is -1, PeekMessage retrieves only messages on the current thread's message queue whose hwnd value is NULL, that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL) or PostThreadMessage .
wMsgFilterMin
[in] Specifies the value of the first message in the range of messages to be examined. Use WM_KEYFIRST to specify the first keyboard message or WM_MOUSEFIRST to specify the first mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no range filtering is performed).
wMsgFilterMax
[in] Specifies the value of the last message in the range of messages to be examined. Use WM_KEYLAST to specify the last keyboard message or WM_MOUSELAST to specify the last mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no range filtering is performed).
wRemoveMsg
[in] Specifies how messages are handled. This parameter can be one of the following values.
PM_NOREMOVE
Messages are not removed from the queue after processing by PeekMessage.
PM_REMOVE
Messages are removed from the queue after processing by PeekMessage.
You can optionally combine the value PM_NOYIELD with either PM_NOREMOVE or PM_REMOVE. This flag prevents the system from releasing any thread that is waiting for the caller to go idle (see WaitForInputIdle ).
By default, all message types are processed. To specify that only certain message should be processed, specify one or more of the following values.
PM_QS_INPUT
Windows 98/Me, Windows 2000/XP: Process mouse and keyboard messages.
PM_QS_PAINT
Windows 98/Me, Windows 2000/XP: Process paint messages.
PM_QS_POSTMESSAGE
Windows 98/Me, Windows 2000/XP: Process all posted messages, including timers and hotkeys.
PM_QS_SENDMESSAGE
Windows 98/Me, Windows 2000/XP: Process all sent messages.
Return Value
If a message is available, the return value is nonzero.
If no messages are available, the return value is zero.
Remarks
PeekMessage retrieves messages associated with the window identified by the hWnd parameter or any of its children as specified by the IsChild function, and within the range of message values given by the wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that PeekMessage always retrieves WM_QUIT messages, no matter which values you specify for wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned by the calling thread using the SendMessage , SendMessageCallback , SendMessageTimeout , or SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
The PeekMessage function normally does not remove WM_PAINT messages from the queue. WM_PAINT messages remain in the queue until they are processed. However, if a WM_PAINT message has a NULL update region, PeekMessage does remove it from the queue.
Windows XP: If a top-level window stops responding to messages for more than several seconds, the system considers the window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the only actions available because the application is actually not responding. When an application is being debugged, the system does not generate a ghost window.
Windows 95/98/Me: PeekMessageW 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 Examining a Message Queue .
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 , GetMessage , IsChild , MSG , WaitForInputIdle , WaitMessage
==原始网址==http://msdn.microsoft.com/en-us/library/ms644943(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:18:27