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
原文地址:http://www.cnblogs.com/laozuan/p/3708763.html