积极答复者
HTC Windows Mobile 6.5 怎么屏蔽物理按键

问题
-
开发了一个软件,想在软件运行的时候,屏蔽所有的物理按键(包括talk按键,home键,声音设置键等,总共5个按键),也就是保持程序一直运行在最前端。在程序退出的时候还原按键。
在Windows Mobile 6.5 屏蔽怎么物理按键?
设备:HTC HD2, Windows Mobile 6.5
开发语言:C#,CF2.0
已经尝试过的方式:
1.用HardwareButton类,Form的KeyDown事件根本就捕获不了物理按键;
2.用Hook,只能屏蔽返回键,但是按了talk键后,手机就卡死了,所以这个方法也不行;
现在按下物理按键,比如home键后,都捕获不了按下事件。
答案
-
用SHCMBM_OVERRIDEKEY 消息 可以屏蔽talk键,SDK中有一个示例可以看一下,
C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\FullScreen
至于home可以用registrerHotkey试一下。我记得hook是可以的,都可以捕获到。但是hook用的时候可能会出问题,就像你说的那样,因为这个在微软的文档是不支持的。
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 Guang-Ming Bian - MSFTModerator 2010年7月15日 7:19
全部回复
-
用SHCMBM_OVERRIDEKEY 消息 可以屏蔽talk键,SDK中有一个示例可以看一下,
C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\FullScreen
至于home可以用registrerHotkey试一下。我记得hook是可以的,都可以捕获到。但是hook用的时候可能会出问题,就像你说的那样,因为这个在微软的文档是不支持的。
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 Guang-Ming Bian - MSFTModerator 2010年7月15日 7:19
-
非常感谢Guang-Ming Bian的回复。
参照您的回复,我又做了以下尝试:
1)参照FullScreen,我添加了键码为114,237,91,92,117的SendMessage,最终只能屏蔽Talk键,也没有实现我要的效果;
2)关于RegisterHotKey函数,我的用法是:
UnregisterFunc1(this.Handle, 91);
RegisterHotKey(this.Handle, 91, KeyModifiers.None, 91);
UnregisterFunc1(this.Handle, 114);
RegisterHotKey(this.Handle, 0, KeyModifiers.None, 114);
UnregisterFunc1(this.Handle, 92);
RegisterHotKey(this.Handle, 92, KeyModifiers.None, 92);
这是一部分,可是都没有任何效果,不知道这个使用方法对不对。
还有其他办法吗?比如修改注册表之类的。
非常感谢您的回复!
-
试一下 hook, 下面是一个示例:
http://blog.opennetcf.com/ayakhnin/PermaLink,guid,84b95802-76d7-499c-b266-e2251ab15706.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
试一下 hook, 下面是一个示例:
http://blog.opennetcf.com/ayakhnin/PermaLink,guid,84b95802-76d7-499c-b266-e2251ab15706.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help