怎么F12键就是不能做虚拟键呢?

jianice 2004-11-23 09:21:15
我做了个后台程序,监控当按下F9 F10 F11 F12键时分别注销 重启 关机 休眠。
但按F12键怎么都没反映,请问是为什么?F12的VK是123吧。

--------------
附源程序部分:

//热键处理过程
procedure TForm1.WMHotKey (var Msg : TWMHotKey);
begin
case msg.HotKey of //分别为注销、重启、关机、休眠
1500001:begin GetSystemPrivilege; ExitWindowsEx(EWX_LOGOFF, 0); end;
1500002:begin GetSystemPrivilege; ExitWindowsEx(EWX_REBOOT, 0); end;
1500003:begin GetSystemPrivilege; ExitWindowsEx(EWX_POWEROFF, 0); end;
1500004:begin GetSystemPrivilege; SetSystemPowerState(false,true); end;
end;
end;

//向系统注册热键 F9:120 F10:121 F11:122 F12:123 Scroll:145
RegisterHotKey(handle,1500001,0,120);
RegisterHotKey(handle,1500002,0,121);
RegisterHotKey(handle,1500003,0,122);
RegisterHotKey(handle,1500004,0,123);

================================
请教为什么RegisterHotKey(handle,1500004,0,123);这句无法注册F12键?也就是说,我按F9 F10 F11都有反映,但不管我怎么按F12键,就是用锤子敲都没用。但如果我用Scrolllock键就没任何问题,即RegisterHotKey(handle,1500004,0,145);

百思不得其解。
请高手回答。谢谢!!!!!!!!!!!!!!!!1
...全文
141 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiirii 2004-12-17
  • 打赏
  • 举报
回复
F12 被系統作用調試用, 這樣是無法註冊的


Windows NT4 and Windows 2000/XP: The F12 key is reserved for use by the debugger at all times, so it should not be registered as a hot key. Even when you are not debugging an application, F12 is reserved in case a kernel-mode debugger or a just-in-time debugger is resident.

terry6394 2004-12-17
  • 打赏
  • 举报
回复
应该没问题吧
不过热键的ID建议你使用GlobalAddAtom 来获得.避免ID冲突
beyondsun 2004-12-10
  • 打赏
  • 举报
回复
你的工程键盘吧?用钩子应该可以
jianice 2004-12-10
  • 打赏
  • 举报
回复
我试过了,用过showmessage的,换其他键都可以,就F12死活无反应
beyondtkl 2004-11-24
  • 打赏
  • 举报
回复
1500004:begin GetSystemPrivilege; SetSystemPowerState(false,true); end;
你把里面的代码改一下 比如一个ShowMessage之类的 表示你的这个HOTKEY注册成功

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧