网站首页  词典首页

请输入您要查询的函数:

 

术语 cbtproc
释义 CBTProc
语法:
LRESULT CALLBACK CBTProc( int nCode,
WPARAM wParam,
LPARAM lParam
);
CBTProc功能
该CBTProc挂钩过程是一个应用程序定义或库定义的回调函数中调用SetWindowsHookEx函数使用。该系统调用此函数之前激活,创建,销毁,最小化,最大化,移动或大小的窗口,在完成一个系统命令,然后从系统中删除消息队列鼠标或键盘事件,前设置键盘焦点;或之前同步与系统消息队列。计算机为基础的培训(CBT)的应用程序使用此挂钩过程接收系统有用的通知。
在HOOKPROC类型定义一个指向这个回调函数。 CBTProc是一个应用程序的占位符定义或库定义的函数的名称。
参数
nCode
[in]指定的代码程序,使用挂钩,以决定如何处理该消息。如果nCode小于零,钩子程序必须通过信息,CallNextHookEx函数没有进一步的处理,并应归还CallNextHookEx返回的值。此参数可以是下列值之一。
HCBT_ACTIVATE
该系统即将启动一个窗口。
HCBT_CLICKSKIPPED
该系统具有从系统中删除消息队列的鼠标消息。一旦收到此挂钩代码,CBT应用程序必须安装在响应鼠标消息一WH_JOURNALPLAYBACK挂钩过程。
HCBT_CREATEWND
窗口即将建立。之前的系统调用发送WM_CREATE或WM_NCCREATE消息窗口的钩子程序。如果挂钩过程返回一个非零值,系统破坏的窗口,在CreateWindow函数返回NULL,但WM_DESTROY消息不会发送到窗口。如果挂钩过程返回零,窗口创建正常。
在HCBT_CREATEWND通知时间,窗口已经建立,但其最终的大小和位置可能没有被确定,它的父窗口可能尚未建立。很可能将消息发送到新创建的窗口,但尚未收到WM_NCCREATE或WM_CREATE消息。它也可以改变位置的Z -新创建的窗口,以便通过修改的CBT_CREATEWND结构hwndInsertAfter成员。
HCBT_DESTROYWND
窗口即将被销毁。
HCBT_KEYSKIPPED
该系统具有从系统中删除消息队列键盘消息。一旦收到此挂钩代码,CBT应用程序必须安装响应键盘消息一WH_JOURNALPLAYBACK挂钩过程。
HCBT_MINMAX
窗口即将最小化或最大化。
HCBT_MOVESIZE
窗口即将被移动或大小。
HCBT_QS
该系统具有检索从系统消息队列WM_QUEUESYNC消息。
HCBT_SETFOCUS
窗口是要接收键盘焦点。
HCBT_SYSCOMMAND
一个系统命令即将进行。这使得CBT应用程序,以防止任务的手段热键切换。
wParam
[in]取决于nCode参数。有关详细信息,请参阅下面的备注部分。
lparam的
[in]取决于nCode参数。有关详细信息,请参阅下面的备注部分。
返回值
由挂钩过程的返回值确定系统是否允许或阻止这些行动之一。对于业务相对应的下列CBT挂钩代码,返回值必须为0,使操作,或1,以避免它。
HCBT_ACTIVATE
HCBT_CREATEWND
HCBT_DESTROYWND
HCBT_MINMAX
HCBT_MOVESIZE
HCBT_SETFOCUS
HCBT_SYSCOMMAND
对于业务相对应的下列CBT挂钩代码,返回值将被忽略。
HCBT_CLICKSKIPPED
HCBT_KEYSKIPPED
HCBT_QS
备注
挂钩过程不应安装,除非在代码的钩前面的列表所述的情况1 WH_JOURNALPLAYBACK_hook挂钩过程。
安装的应用程序通过指定WH_CBT挂钩类型和在调用指针挂钩过程的SetWindowsHookEx函数钩子程序。
下表描述了每种HCBT_钩代码WPARAM和LPARAM参数。
ValuewParamlParam
HCBT_ACTIVATESpecifies的窗口句柄即将activated.Specifies长指针CBTACTIVATESTRUCT结构包含句柄活动窗口,并指定是否激活,是因为点击鼠标改变。
HCBT_CLICKSKIPPEDSpecifies的鼠标消息从系统消息中删除queue.Specifies长指针MOUSEHOOKSTRUCT结构,包含点击测试代码和处理,供该鼠标消息的目的是窗口。
该HCBT_CLICKSKIPPED值发送到CBTProc挂钩过程只有当WH_MOUSE钩子安装。如需暗杀名单,测试代码,见WM_NCHITTEST。
HCBT_CREATEWNDSpecifies的句柄新window.Specifies长指针CBT_CREATEWND结构载有窗口的初始化参数。这些参数包括坐标和窗口的尺寸。通过改变这些参数,一CBTProc挂钩过程可以设置初始大小和窗口的位置。
HCBT_DESTROYWNDSpecifies的窗口句柄将要destroyed.Is不确定的,必须设置为零。
HCBT_KEYSKIPPEDSpecifies的虚拟键code.Specifies的重复计数,扫描码,关键过渡代码,以前的国家重点和上下文中运行代码。该HCBT_KEYSKIPPED值发送到CBTProc挂钩过程只有当WH_KEYBOARD钩子安装。有关更多信息,请参阅WM_KEYUP或WM_KEYDOWN。
HCBT_MINMAXSpecifies的句柄窗口最小化或maximized.Specifies在低位字,一个展示窗口值(SW_)指定操作。如需显示列表窗口值,见在ShowWindow。高字是不确定的。
HCBT_MOVESIZESpecifies的句柄窗口移动或sized.Specifies长指针RECT结构包含窗口的坐标。通过改变结构,CBTProc挂钩过程可以设置最后的价值坐标的窗口。
HCBT_QSIs不确定的,必须zero.Is界定,必须为零。
HCBT_SETFOCUSSpecifies的窗口句柄获得键盘focus.Specifies的句柄窗口失去键盘焦点。
HCBT_SYSCOMMANDSpecifies系统的命令值(SC_)指定的系统命令。欲了解更多关于系统命令值,见WM_SYSCOMMAND的。包含作为一个WM_SYSCOMMAND的消息lParam值相同的数据:如果一个系统菜单命令用鼠标选定后,低位字包含的x坐标光标在屏幕坐标,以及高阶字包含Y坐标,否则,该参数没有使用。
有关信息,请WinEvents。
功能信息
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryNone
最低操作系统Windows 95,Windows NT 3.1
参见
钩概述,CallNextHookEx,CreateWindow,钩子,WM_SYSCOMMAND的
==英文原文==CBTProc Function
The CBTProc hook procedure is an application-defined or library-defined callback function used with the SetWindowsHookEx function. The system calls this function before activating, creating, destroying, minimizing, maximizing, moving, or sizing a window; before completing a system command; before removing a mouse or keyboard event from the system message queue; before setting the keyboard focus; or before synchronizing with the system message queue. A computer-based training (CBT) application uses this hook procedure to receive useful notifications from the system.
The HOOKPROC type defines a pointer to this callback function. CBTProc is a placeholder for the application-defined or library-defined function name.
Syntax
LRESULT CALLBACK CBTProc( int nCode,
WPARAM wParam,
LPARAM lParam
);
Parameters
nCode
[in] Specifies a code that the hook procedure uses to determine how to process the message. If nCode is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx. This parameter can be one of the following values.
HCBT_ACTIVATE
The system is about to activate a window.
HCBT_CLICKSKIPPED
The system has removed a mouse message from the system message queue. Upon receiving this hook code, a CBT application must install a WH_JOURNALPLAYBACK hook procedure in response to the mouse message.
HCBT_CREATEWND
A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally.
At the time of the HCBT_CREATEWND notification, the window has been created, but its final size and position may not have been determined and its parent window may not have been established. It is possible to send messages to the newly created window, although it has not yet received WM_NCCREATE or WM_CREATE messages. It is also possible to change the position in the z-order of the newly created window by modifying the hwndInsertAfter member of the CBT_CREATEWND structure.
HCBT_DESTROYWND
A window is about to be destroyed.
HCBT_KEYSKIPPED
The system has removed a keyboard message from the system message queue. Upon receiving this hook code, a CBT application must install a WH_JOURNALPLAYBACK hook procedure in response to the keyboard message.
HCBT_MINMAX
A window is about to be minimized or maximized.
HCBT_MOVESIZE
A window is about to be moved or sized.
HCBT_QS
The system has retrieved a WM_QUEUESYNC message from the system message queue.
HCBT_SETFOCUS
A window is about to receive the keyboard focus.
HCBT_SYSCOMMAND
A system command is about to be carried out. This allows a CBT application to prevent task switching by means of hot keys.
wParam
[in] Depends on the nCode parameter. For details, see the following Remarks section.
lParam
[in] Depends on the nCode parameter. For details, see the following Remarks section.
Return Value
The value returned by the hook procedure determines whether the system allows or prevents one of these operations. For operations corresponding to the following CBT hook codes, the return value must be 0 to allow the operation, or 1 to prevent it.
HCBT_ACTIVATE
HCBT_CREATEWND
HCBT_DESTROYWND
HCBT_MINMAX
HCBT_MOVESIZE
HCBT_SETFOCUS
HCBT_SYSCOMMAND
For operations corresponding to the following CBT hook codes, the return value is ignored.
HCBT_CLICKSKIPPED
HCBT_KEYSKIPPED
HCBT_QS
Remarks
The hook procedure should not install a WH_JOURNALPLAYBACK_hook hook procedure except in the situations described in the preceding list of hook codes.
An application installs the hook procedure by specifying the WH_CBT hook type and a pointer to the hook procedure in a call to the SetWindowsHookEx function.
The following table describes the wParam and lParam parameters for each HCBT_ hook code.
ValuewParamlParam
HCBT_ACTIVATESpecifies the handle to the window about to be activated.Specifies a long pointer to a CBTACTIVATESTRUCT structure containing the handle to the active window and specifies whether the activation is changing because of a mouse click.
HCBT_CLICKSKIPPEDSpecifies the mouse message removed from the system message queue.Specifies a long pointer to a MOUSEHOOKSTRUCT structure containing the hit-test code and the handle to the window for which the mouse message is intended.
The HCBT_CLICKSKIPPED value is sent to a CBTProc hook procedure only if a WH_MOUSE hook is installed. For a list of hit-test codes, see WM_NCHITTEST .
HCBT_CREATEWNDSpecifies the handle to the new window.Specifies a long pointer to a CBT_CREATEWND structure containing initialization parameters for the window. The parameters include the coordinates and dimensions of the window. By changing these parameters, a CBTProc hook procedure can set the initial size and position of the window.
HCBT_DESTROYWNDSpecifies the handle to the window about to be destroyed.Is undefined and must be set to zero.
HCBT_KEYSKIPPEDSpecifies the virtual-key code.Specifies the repeat count, scan code, key-transition code, previous key state, and context code. The HCBT_KEYSKIPPED value is sent to a CBTProc hook procedure only if a WH_KEYBOARD hook is installed. For more information, see WM_KEYUP or WM_KEYDOWN .
HCBT_MINMAXSpecifies the handle to the window being minimized or maximized.Specifies, in the low-order word, a show-window value (SW_) specifying the operation. For a list of show-window values, see the ShowWindow . The high-order word is undefined.
HCBT_MOVESIZESpecifies the handle to the window to be moved or sized.Specifies a long pointer to a RECT structure containing the coordinates of the window. By changing the values in the structure, a CBTProc hook procedure can set the final coordinates of the window.
HCBT_QSIs undefined and must be zero.Is undefined and must be zero.
HCBT_SETFOCUSSpecifies the handle to the window gaining the keyboard focus.Specifies the handle to the window losing the keyboard focus.
HCBT_SYSCOMMANDSpecifies a system-command value (SC_) specifying the system command. For more information about system-command values, see WM_SYSCOMMAND . Contains the same data as the lParam value of a WM_SYSCOMMAND message: If a system menu command is chosen with the mouse, the low-order word contains the x-coordinate of the cursor, in screen coordinates, and the high-order word contains the y-coordinate; otherwise, the parameter is not used.
For information, see WinEvents .
Function Information
HeaderDeclared in Winuser.h, include Windows.h
Import libraryNone
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
Hooks Overview , CallNextHookEx , CreateWindow , SetWindowsHookEx , WM_SYSCOMMAND
==原始网址==http://msdn.microsoft.com/en-us/library/ms644977(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:26:30