首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

想用windows API 实现alt+a键的组合按键,不知道如何实现,请

2012-02-25 
想用windows API 实现alt+a键的组合按键,不知道怎么实现,请高手指点急!!![解决办法]BOOL RegisterHotKey(H

想用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);

热点排行