simulated key-press of cursor-up/down ? - Programmer

This is a discussion on simulated key-press of cursor-up/down ? - Programmer ; Hi, in the past it worked well to send from own program a simulated Key- press of the Cursor-up key Taste to another program, that in the other prgram the selection of an item in a listfield moves one step ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: simulated key-press of cursor-up/down ?

  1. simulated key-press of cursor-up/down ?


    Hi,

    in the past it worked well to send from own program a simulated Key-
    press of the Cursor-up key Taste to another program, that in the other
    prgram the selection of an item in a listfield moves one step up/down:

    sendmessage(wnd,WM_KEYDOWN,VK_UP,0);
    sendmessage(wnd,WM_KEYUP,VK_up,0);

    Now its not working anymore somehow (software-update), albeit e.g. a
    simulated double-click still works by using

    sendmessage(wnd,WM_lBUTTONDBLCLK,0,0);


    I always used 0 as last parameter.


    The MSDN (http://msdn2.microsoft.com/en-us/library/ms912654.aspx)
    says

    WM_KEYDOWN nVirtKey = (int) wParam; lKeyData = lParam;

    lKeyData:
    Specifies the repeat count, context code, previous key-state flag,
    and transition-state flag, as shown in the following table ...


    Does new programs have different handling ("Standards") ? And instead
    of using 0 one have to specify lKeyData in detail, that vk_up will be
    understood ? I mean, the couble-click is still working as in the past

    Any Ideas?

    Thanks a lot,


  2. Re: simulated key-press of cursor-up/down ?

    wrote in message
    news:1192145365.585790.108750@e9g2000prf.googlegro ups.com...
    > in the past it worked well to send from own program a simulated Key-
    > press of the Cursor-up key Taste to another program, that in the other
    > prgram the selection of an item in a listfield moves one step up/down:
    >
    > sendmessage(wnd,WM_KEYDOWN,VK_UP,0);
    > sendmessage(wnd,WM_KEYUP,VK_up,0);
    >
    > Now its not working anymore somehow (software-update), albeit e.g. a
    > simulated double-click still works by using
    >
    > sendmessage(wnd,WM_lBUTTONDBLCLK,0,0);


    Are you sure this worked in a previous version?
    It seems you mistake VK_UP for a mouse button click -- which is *not*
    WM_LBUTTONUP, because that is a system message. The mouse buttons have their
    own VK_ values. Either use WM_KEYDOWN/UP with the VK_ values for the mouse
    buttons, or send WM_LBUTTONDOWN/UP messages.

    [Jongware]



  3. Re: simulated key-press of cursor-up/down ?

    > Are you sure this worked in a previous version?
    > It seems you mistake VK_UP for a mouse button click -- which is *not*
    > WM_LBUTTONUP, because that is a system message. The mouse buttons have their
    > own VK_ values. Either use WM_KEYDOWN/UP with the VK_ values for the mouse
    > buttons, or send WM_LBUTTONDOWN/UP messages.


    Hi,

    yes you are right, two different things. On the one hand key-press
    message, on the other hand mouseclick-message.
    However, in the past it worked for both, for the key by using

    sendmessage(wnd,WM_KEYDOWN,VK_UP,0);
    sendmessage(wnd,WM_KEYUP,VK_UP,0);

    If the user is manually in the list of the targeted application the
    item selector respond to pressing the key cursor-up or cursor-down.
    However, actually you can simulate it by sendmessage as above, but it
    does not work anymore. Are there other options to try ?

    Sending 0 as last param still sufficient?

    Thanks a lot.


+ Reply to Thread