Q;截系统热键
A;public class Win32Hook
{

 [DllImport("kernel32")]
 public static extern int GetCurrentThreadId();

 [DllImport( "user32",
CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
 public static extern int  SetWindowsHookEx(
  HookType idHook,
  HOOKPROC lpfn,
  int hmod,
  int dwThreadId);

 public enum HookType
 {
  WH_KEYBOARD = 2
 }
 
public delegate int HOOKPROC(int nCode, int wParam, int lParam);

 public void SetHook()
 {
  // set the keyboard hook
  SetWindowsHookEx(HookType.WH_KEYBOARD,
   new HOOKPROC(this.MyKeyboardProc),
   0,
   GetCurrentThreadId());
 }

 public int MyKeyboardProc(int nCode, int wParam, int lParam)
 {
  //Perform your process
  return 0;
 }
}

相关文章:

  • 2021-12-10
  • 2022-01-16
  • 2022-01-20
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2022-01-20
  • 2021-05-29
  • 2021-11-25
  • 2022-02-20
相关资源
相似解决方案