读书人

怎么向一个窗体发送组合键消息

发布时间: 2012-02-19 19:43:39 作者: rapoo

如何向一个窗体发送组合键消息?
我已经取得一个窗体的句柄
想向窗体发送一个ctrl+A
我用
SendMessage(hwnd,WM_KEYDOWN,VK_CONTROL,0);
SendMessage(hwnd,WM_KEYDOWN,41,1);
SendMessage(hwnd,WM_KEYDOWN,VK_CONTROL,0);
SendMessage(hwnd,WM_KEYDOWN,41,1);
这样写 没用!
用KEY_EVENT正在尝试

究竟应该怎么发送一个组合键消息?关键就是LPARAM参数
0-15
Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated 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 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 always 0 for a WM_KEYDOWN message.
30
Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
31
Specifies the transition state. The value is always zero for a WM_KEYDOWN message

难道我应该写 2000000000000000000000000000001 一个32位的整数?



[解决办法]
SendInput
[解决办法]
学习下

读书人网 >C++ Builder

热点推荐