WM_ACTIVATE message

WM_ACTIVATE message

          

Sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately.

C++
#define WM_ACTIVATE                     0x0006

Parameters

wParam

The low-order word specifies whether the window is being activated or deactivated. This parameter can be one of the following values. The high-order word specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

ValueMeaning
WA_ACTIVE 1

Activated by some method other than a mouse click (for example, by a call to theSetActiveWindow function or by use of the keyboard interface to select the window).

WA_CLICKACTIVE 2

Activated by a mouse click.

WA_INACTIVE 0

Deactivated.

 

lParam

A handle to the window being activated or deactivated, depending on the value of thewParam parameter. If the low-order word of wParam is WA_INACTIVE,lParam is the handle to the window being activated. If the low-order word ofwParam is WA_ACTIVE or WA_CLICKACTIVE,lParam is the handle to the window being deactivated. This handle can beNULL.

 

Return value

If an application processes this message, it should return zero.

Remarks

If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window. If the window is activated by a mouse click, it also receives aWM_MOUSEACTIVATE message.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Hook(钩子)并不是一项很难的技术,但对于初学者来说还是一个不小的门槛。为此,我将鼠标Hook做成了一个可视化的控件,通过简单的设置几个属性,就可以截获或跟踪其它应用程序的鼠标动作。**********控件介绍:【属性】1.Blocked: Boolean;确定是截获还是跟踪鼠标动作,True对应截获,False对应跟踪。默认值为False2.HookedExeName: string;指定被Hook的应用程序名称。为空时对所有的应用程序起作用。默认值为空3.Active: Boolean;是否处于Hook状态,只读。4.DllName: string;Mouse钩子的dll名称,默认为MouseHook.dll,只读。5.DLLLoaded: Boolean;MouseHook.dll是否被加载,只读。【方法】1.function Start: Boolean;开始Hook2.procedure Stop;停止Hook【事件】 WM_LBUTTONDBLCLK, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_NCMOUSEMOVE, WM_MOUSEACTIVATE, WM_NCHITTEST, WM_CAPTURECHANGED我处理了如上的鼠标事件,注意其中有几个事件我在测试时发现无法Hook,它们为WM_MBUTTONDBLCLK,WM_NCMBUTTONDBLCLK,WM_MOUSEACTIVATEWM_NCHITTEST,WM_CAPTURECHANGED建议:不要将HookedExeName:=''; 和 Blocked:=True; 同时设置**********【使用说明】1.首先安装“鼠标Hook控件”目录下的控件2.必须将mousehook.dll拷贝到你开发的应用程序目录下,或系统目录下,如system32【多说几句】1.我提供了一个名为test.exe的demo,该例子是对notepad.exe进行Hook的,因此,使用前先启动notepad.exe,再点击界面上的“开始”,否则会提示“找不到指定的进程”!2.你可以参考我的控件设计模式来设计自己的Hook控件,如键盘Hook。3.本来想写一个组件包的,其中包括各种Hook控件,以及读写端口的控件,以方便初学者的使用,可是要些论文,以后再说吧。 黄晓斌 hxb_leiyuan2000@163.net QQ:478522325
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值