BOOL RegisterHotKey( HWND hWnd, // window to receive hot-key notification int id, // identifier of hot key UINT fsModifiers, // key-modifier flags UINT vk // virtual-key code ); vk Specifies the virtual-key code of the hot key.//RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.
HWND hWnd, // window to receive hot-key notification
int id, // identifier of hot key
UINT fsModifiers, // key-modifier flags
UINT vk // virtual-key code
);
vk
Specifies the virtual-key code of the hot key.//RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.
RegisterHotKey的时候不能id值相同,这个id值作为WM_HOTKY的WPARAM差数传递的,估计是你的后面个RegisterHotKey的id把前面的RegisterHotKey的id覆盖了。
ATOM id;
id = GlobalAddAtom("Hotkey_123");
RegisterHotKey(handle, id, MOD_CONTROL|MOD_ALT, VK_F1);
销毁窗口的时候最好GlobalDeleteAtom删除注册的原子
最好用GlobalAddAtom分配一个id,不是必须
居然不能编辑帖子,郁闷~~
RegisterHotKey(m_hWnd,1001,MOD_CONTROL|MOD_ALT,VK_F1); 就是把VK换成F1至F12都不行
我是说你的这个id为1001不能重复,id值作为WM_HOTKEY的WPARAM值传递给程序,进行热键识别的标示,我认为你的程序是不是RegisterHotKey(m_hWnd,1001,MOD_CONTROL|MOD_ALT,VK_F1);RegisterHotKey(m_hWnd,1001,MOD_CONTROL|MOD_ALT,'S');这两句都执行了,你把它们顺序交换下就清楚了,我这里没问题的啊。我也是RegisterHotKey(m_hWnd, 1001, MOD_CONTROL|MOD_ALT, VK_F1);可以的啊,你需要的话我可以把我的程序给你。