设置应用程序的热键
实现:
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private const int WM_SETHOTKEY = 0x0032;
private const int HOTKEYF_ALT = 0x0004;
private void Form1_Load(object sender, System.EventArgs e)
{
int wHotkey;
wHotkey = (HOTKEYF_ALT) * 0x0100 + 'A';
SendMessage(this.Handle, WM_SETHOTKEY, wHotkey, 0);
}