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

zhangzhiye 2008-05-22 07:23:45
急!!!
...全文
136 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fendou1987 2008-06-02
  • 打赏
  • 举报
回复
LZ的需求没说清楚
zhangzhiye 2008-05-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wodegege10 的回复:]
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
KeyMo…
[/Quote]
id那里不太明白...
王集鹄 2008-05-22
  • 打赏
  • 举报
回复
SendKeys.Send("+A");
不知道楼要问啥,先蒙一个。。。[img=http://p.blog.csdn.net/images/p_blog_csdn_net/ming4098/363510/o_%E6%9C%AA%E5%91%BD%E5%90%8D.jpg]图[/img]
jinjazz 2008-05-22
  • 打赏
  • 举报
回复
热键注册,参考
http://blog.csdn.net/jinjazz/archive/2007/11/15/1886055.aspx
wenbin 2008-05-22
  • 打赏
  • 举报
回复
还可以使用
[DllImport("user32.dll", SetLastError=true)]
public static extern bool UnregisterHotKey( IntPtr hWnd, // handle to window
int id // hot key identifier
);
解除注册
wenbin 2008-05-22
  • 打赏
  • 举报
回复
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);

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧