现在想向一个其他的应用程序窗口发送“alt+R"的信息。使用
::PostMessage((HWND)ProcessInfo.hProcess,WM_CHAR,wParam,lParam);
但是不知道具体的wParam和lParam的值。wParam也许是'R',但是lParam就不知道了,请问大家有知道的吗?
::PostMessage((HWND)ProcessInfo.hProcess,WM_CHAR,wParam,lParam);
但是不知道具体的wParam和lParam的值。wParam也许是'R',但是lParam就不知道了,请问大家有知道的吗?
WPARAM wParam
LPARAM lParam;ParameterswParam
Specifies the character code of the 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.
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 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.
WPARAM wParam //包含按的什么键
LPARAM lParam //一些附加信息,如在按键的同时是否按了Ctrl、Alt、Shift键
按下ctrl+r时,wParam,lParam的值。
按下"r",看wParam,lParam
按下"ctrl+r",看wParam,lParam