如何在winXP下屏蔽win键呀,谢谢 ( 积分: 50 )

  • 主题发起人 主题发起人 liubingji
  • 开始时间 开始时间
L

liubingji

Unregistered / Unconfirmed
GUEST, unregistred user!
win键就是那个在ctrl右边alt左边那个,那们朋友知道如何做呀。
 
win键就是那个在ctrl右边alt左边那个,那们朋友知道如何做呀。
 
这个的中断级别好像很高的啊!关注。。。
 
用Hook钩子
 
Windows Registry Editor Version 5.00<br>[HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Keyboard Layout]<br>&quot;Scancode Map&quot;=hex:00,00,00,00,00,00,00,00,03,00,00,00,00,00,5b,e0,00,00,00,00<br>导入注册表重启即可。
 
我想在程序里实现,想让它能用就能用,不能用就不能用
 
//winxp下屏蔽win键的dll,调用BeginHook和EndHook就可以了.<br>library HookDLL;<br>uses<br> &nbsp;Windows, SysUtils, Messages;<br><br>var<br> &nbsp;KeyHook: HHook;<br><br>function HookKey(Code: integer; wParam: wParam; lParam: lParam): LRESULT; stdcall;<br>type<br> &nbsp;PKBDLLHOOKSTRUCT = ^KBDLLHOOKSTRUCT;<br> &nbsp;KBDLLHOOKSTRUCT = record<br> &nbsp; &nbsp;vkCode: DWORD;<br> &nbsp; &nbsp;ScanCode: DWORD;<br> &nbsp; &nbsp;Flags: DWORD;<br> &nbsp; &nbsp;Time: DWORD;<br> &nbsp; &nbsp;dwExtraInfo: DWORD;<br> &nbsp;end;<br>begin<br> &nbsp;//屏蔽win键<br> &nbsp;if (Code = HC_ACTION) and ((PKBDLLHOOKSTRUCT(lParam).vkCode = VK_LWIN)<br> &nbsp; &nbsp;or (PKBDLLHOOKSTRUCT(lParam).vkCode = VK_RWIN)) then begin<br> &nbsp; &nbsp;Result := 1<br> &nbsp;end<br> &nbsp;else<br> &nbsp; &nbsp;Result := CallNextHookEx(KeyHook, Code, wParam, lParam);<br>end;<br><br>procedure BeginHook;<br>begin<br> &nbsp;KeyHook := SetWindowsHookEx(13{=WH_KEYBOARD_LL}, @HookKey, HInstance, 0);<br>end;<br><br>procedure EndHook;<br>begin<br> &nbsp;UnhookWindowsHookEx(KeyHook);<br>end;<br><br>exports<br> &nbsp;BeginHook, EndHook;<br><br>begin<br><br>end.<br><br><br>//exe调用例子<br>unit FrmExe;<br><br>interface<br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, ExtCtrls, StdCtrls, Buttons;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;btn1: TButton;<br> &nbsp; &nbsp;btn2: TButton;<br> &nbsp; &nbsp;procedure btn1Click(Sender: TObject);<br> &nbsp; &nbsp;procedure btn2Click(Sender: TObject);<br> &nbsp; &nbsp;procedure FormClose(Sender: TObject; var Action: TCloseAction);<br> &nbsp;private<br><br> &nbsp;public<br><br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br><br>procedure &nbsp;BeginHook; &nbsp;external 'HookDLL.dll';<br>procedure &nbsp;EndHook; &nbsp;external 'HookDLL.dll';<br><br>implementation<br><br>{$R *.dfm}<br>procedure TForm1.btn1Click(Sender: TObject);<br>begin<br> &nbsp;BeginHook;<br>end;<br><br>procedure TForm1.btn2Click(Sender: TObject);<br>begin<br> &nbsp;EndHook;<br>end;<br><br>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br> &nbsp;EndHook;<br>end;<br><br>end.
 

Similar threads

后退
顶部