[DllImport("user32")]
public static extern bool RegisterHotKey(IntPtr hWnd,int id,uint control,Keys vk );
//Register hotkey api
[DllImport("user32")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
private void Form1_Load(object sender, EventArgs e)
{
//Register hotkeys (form handle, hotkey ID, auxiliary key, real key)
RegisterHotKey(, 888, 2, );
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
//Recall the hotkey (handle, hotkey ID)
UnregisterHotKey(, 888);
}
protected override void WndProc(ref Message m)
{
switch ()
{
case 0x0312: //This is a registered hotkey message defined by window message
if (().Equals("888")) //If it is the hotkey we registered
("You press ctrl+a");
break;
}
(ref m);
}