日期:2014-05-18  浏览次数:20832 次

想用windows API 实现alt+a键的组合按键,不知道怎么实现,请高手指点
急!!!


------解决方案--------------------
BOOL RegisterHotKey( HWND hWnd,
int id,
UINT fsModifiers,
UINT vk
);

public enum KeyModifiers
{
None = 0,
Alt = 1,
Control = 2,
Shift = 4,
Windows = 8
}

[DllImport("user32.dll", SetLastError=true)]
public static extern bool RegisterHotKey( IntPtr hWnd, // handle to window
int id, // hot key identifier
KeyModifiers fsModifiers, // key-modifier options
Keys vk // virtual-key code
); 

RegisterHotKey(Handle, 94, KeyModifiers.Alt, Keys.A);