文件名称:C#屏蔽Windows快捷键及任务管理器
文件大小:7KB
文件格式:TXT
更新时间:2017-08-21 04:41:27
C#屏蔽快捷键 任务管理器
C#屏蔽Windows快捷键及任务管理器 public delegate int HookProc(int nCode, int wParam, IntPtr lParam); private static int hHook = 0; public const int WH_KEYBOARD_LL = 13; //LowLevel键盘截获,如果是WH_KEYBOARD=2,并不能对系统键盘截取,会在你截取之前获得键盘。 private static HookProc KeyBoardHookProcedure; //键盘Hook结构函数 [StructLayout(LayoutKind.Sequential)] public class KeyBoardHookStruct { public int vkCode; public int scanCode; public int flags; public int time; public int dwExtraInfo; } //设置钩子 [DllImport("user32.dll")] public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] //抽掉钩子 public static extern bool UnhookWindowsHookEx(int idHook); [DllImport("user32.dll")] //调用下一个钩子 public static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam); [DllImport("kernel32.dll")] public static extern int GetCurrentThreadId();