现在想向一个其他的应用程序窗口发送“alt+R"的信息。使用
::PostMessage((HWND)ProcessInfo.hProcess,WM_CHAR,wParam,lParam);
但是不知道具体的wParam和lParam的值。wParam也许是'R',但是lParam就不知道了,请问大家有知道的吗?

解决方案 »

  1.   

    WM_CHAR
        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.
      

  2.   

    WM_CHAR
        WPARAM wParam  //包含按的什么键
        LPARAM lParam  //一些附加信息,如在按键的同时是否按了Ctrl、Alt、Shift键
      

  3.   

    对呀,我想要的就是具体的值,比如wParam='r',lParam=0x20000000,但是lParam的值不对。请问谁知道具体的值?
      

  4.   

    跟踪一下,不就知道了。看一看:只按下"r",wParam,lParam的值。
    按下ctrl+r时,wParam,lParam的值。
      

  5.   

    跟踪一下,就知道具体值。
    按下"r",看wParam,lParam
    按下"ctrl+r",看wParam,lParam
      

  6.   

    具体的值知道了,wParam='r',lParam=538116097L,这是通过TranslateMsg取得的,肯定没有问题,但是利用SendMessage()发送后,其他的程序还是接受不到,窗口句炳没有问题,可以用PostMessage(hwnd,WM_QUIT,0,0)测试,到底差那儿呢,郁闷!