win7:
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyBoardHookProcedure, IntPtr.Zero,
0);
XP:
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyBoardHookProcedure,
Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
可以先执行win7的语句,如果返回的hHook是0,就再执行一次XP的方法。
win7和XP下全局键盘钩子的方法并不相同,布布扣,bubuko.com
时间: 2024-10-26 07:57:28