win7和XP下全局键盘钩子的方法并不相同
时间:2014-05-09 12:44:00
收藏:0
阅读:396
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的方法。
评论(0)