自己编写一个程序,在该程序中,有个按钮,点击按钮后,发送ctrl+W给VC程序,热键激活MFC ClassWizard。
怎么发送ctrl键啊?
怎么发送ctrl键啊?
解决方案 »
- 为什么在VC6里面用std::提示‘std’is not a class or namespace name?
- PlaySound 播放音乐的问题
- 求绘制椭圆的函数实现(不是现成的函数)
- 如何通过编程实现更改系统策略?
- 急救啊!不明白!
- 请问基础类库的一个函数的意思?谢谢各位大虾
- 高分请教:局域网内的共享文件夹问题!
- IDC_HAND找不到
- 想修改子窗口的风格,为什么在PreCreateWindow()中修改不起作用?
- 请教COM+事件模型的问题?
- 问题比较偏,如果有人能回答我再给更多的分。
- 用socket通过机器名(用作host)连接本机IIS的80端口,结果返回拒绝连接,跟IIS中什么设置有关?
The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_SYSCHAR
WPARAM wParam, // character code (TCHAR)
LPARAM lParam // key data
);
Parameters
wParam
Specifies the character code of the window menu key.
lParam
Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Meaning
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke was auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25–28 Reserved; do not use.
29 Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.
::SendMessage( hWnd, WM_KEYDOWN, 'W',0);
::SendMessage( hWnd, WM_KEYDOWN, 'W',0);
Sleep (30);
::SendMessage( hEditWnd, WM_KEYUP, 'W',0);
keybd_event( VK_CONTROL,0,KEYEVENTF_KEYUP,0 );