钩子(HOOK)函数教程(二十五)

时间:2010年04月21日 点击:587

下面是各种Notification即通知。

通知1WM_CANCELJOURNAL Notification

The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle.

当用户取消应用程序的日志记录活动时,WM_CANCELJOURNAL消息被传递给应用程序。该消息以空窗体句柄的方式来传递。

Syntax WM_CANCELJOURNAL

Return Value 返回值

This message does not return a value. It is meant to be processed from within an application's main loop or a GetMessage hook procedure, not from a window procedure.

该消息没有返回值。这意味着在应用程序的主循环中被处理,或者在GetMessage钩子子程内被处理,而不是在窗体程序中被处理。

Remarks 备注

Journal record and playback modes are modes imposed on the system that let an application sequentially record or play back user input. The system enters these modes when an application installs a JournalRecordProc or JournalPlaybackProc hook procedure. When the system is in either of these journaling modes, applications must take turns reading input from the input queue. If any one application stops reading input while the system is in a journaling mode, other applications are forced to wait.

日志记录和回放模式是强加在系统上的模式,它们使应用程序序列化记录和回放用户的输入。当应用程序安装JournalRecordProc JournalPlaybackProc钩子子程时,系统就进入这样的模式。当系统处于这些模式中的任意一个时,应用程序必须轮流从输入队列读入输入。当系统处于记录模式时,如果任何一个应用程序停止读取输入,其他应用程序被迫要等待。

To ensure a robust system, one that cannot be made unresponsive by any one application, the system automatically cancels any journaling activities when a user presses CTRL+ESC or CTRL+ALT+DEL. The system then unhooks any journaling hook procedures, and posts a WM_CANCELJOURNAL message, with a NULL window handle, to the application that set the journaling hook.

为了保证系统的强壮性,一个应用程序不能因为其他应用程序的影响而失去响应。当用户按下时CTRL+ESC 或者CTRL+ALT+DEL时,系统自动取消任何记录行为,然后系统卸载任何记录钩子子程,向安装该记录钩子的应用程序传递一个WM_CANCELJOURNAL消息,该消息含有一个空窗体句柄,

The WM_CANCELJOURNAL message has a NULL window handle, therefore it cannot be dispatched to a window procedure. There are two ways for an application to see a WM_CANCELJOURNAL message: If the application is running in its own main loop, it must catch the message between its call to GetMessage or PeekMessage and its call to DispatchMessage. If the application is not running in its own main loop, it must set a GetMsgProc hook procedure (through a call to SetWindowsHookEx specifying the WH_GETMESSAGE hook type) that watches for the message.

WM_CANCELJOURNAL消息包含一个空窗体句柄,因此不能被分派给窗体程序。应用程序有2种方式可以查看WM_CANCELJOURNAL消息:如果应用程序在它自己的主循环下运行,必须在它调用GetMessage或者PeekMessageDispatchMessage之间,捕获该消息。如果应用程序没有运行在自己的主循环下,必须设置tMsgProc钩子子程(通过指定WH_GETMESSAGE钩子类型调用dowsHookEx)来监视消息。

When an application sees a WM_CANCELJOURNAL message, it can assume two things: the user has intentionally cancelled the journal record or playback mode, and the system has already unhooked any journal record or playback hook procedures.

当应用程序查看WM_CANCELJOURNAL消息时,可以假设2件事情:用户已经特意取消了记录和回放模式,并且,系统已经卸载了任何记录或者回放钩子子程。

Note that the key combinations mentioned above (CTRL+ESC or CTRL+ALT+DEL) cause the system to cancel journaling. If any one application is made unresponsive, they give the user a means of recovery. The VK_CANCEL virtual key code (usually implemented as the CTRL+BREAK key combination) is what an application that is in journal record mode should watch for as a signal that the user wishes to cancel the journaling activity. The difference is that watching for VK_CANCEL is a suggested behavior for journaling applications, whereas CTRL+ESC or CTRL+ALT+DEL cause the system to cancel journaling regardless of a journaling application's behavior.

注意: 前面提到的组合键(CTRL+ESC 或者CRL+ALT+DEL)会导致系统停止记录。如果任何一个应用程序无响应,它们给用户提供了一种恢复的方式。虚拟键值VK_CANCEL(通常以 CTRL+BREAK来实现)是任何一个处于日志记录模式的应用程序都应该监视的,该值被用作用户希望取消记录活动的信号。不同之处在于,记录型应用程序监视VK_CANCEL是一种建议,但是CTRL+ESC 或者CTRL+ALT+DEL引发系统取消记录,忽略监视型应用程序的行为。

Helios  2007-5-31

 

赞助商链接

热门内容

相关内容

联系我们

联系方式