VC++ keybd_event and VK_SHIFT problem

Discussion in 'C++' started by roshan@exeltech.com, May 30, 2006.

  1. Guest

    All,

    Hello. I am a Software Developer currently creating an emulation
    program for our company's System Administrator. He will be able to
    call the program and emulate any keyboard combination, or at least
    that's the goal. Problem is I am having severe troubles emulating
    Shift key combos like (Shift key + End) for example. Nothing happens!
    Some combos work such as Shift key + h which gives 'H'. The problem is
    more specifically related with emulating the highlighting of characters
    which is done for copying or cutting text. The OS I am using is
    Windows 2000. Just to let you view a snippet of the code I'm trying to
    execute, here it is:

    keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), 0, 0);
    Sleep(250);
    keybd_event(VK_END, MapVirtualKey(VK_END, 0), 0, 0);
    Sleep(250);
    keybd_event(VK_END, MapVirtualKey(VK_END, 0), KEYEVENTF_KEYUP, 0);
    Sleep(250);
    keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP,
    0);
    Sleep(250);

    Please note I've also tried:

    VK_LSHIFT instead of VK_SHIFT, but doesn't work.

    VK_RSHIFT instead of VK_SHIFT. The highlighting and text copying work,
    but shift key stays pressed down afterward. I have to manually hit
    right shift key to release it. I shouldn't have to do this.

    Please provide any help if you know the solution.

    Regards,

    Roshan
    , May 30, 2006
    #1
    1. Advertising

  2. wrote:
    > [...] Some combos work such as Shift key + h which gives 'H'. The problem
    > is [..] VK_RSHIFT instead of VK_SHIFT. [..]
    >
    > Please provide any help if you know the solution.


    Please post to 'comp.os.ms-windows.programmer.win32' where this is
    on topic. Here it isn't.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, May 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    0
    Views:
    1,011
  2. chella
    Replies:
    1
    Views:
    731
    Victor Bazarov
    Aug 11, 2004
  3. keybd_event()

    , Jan 11, 2005, in forum: C++
    Replies:
    3
    Views:
    6,854
    lallous
    Jan 11, 2005
  4. daniele.balducci

    keybd_event function behaviour

    daniele.balducci, Oct 18, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    174
    daniele.balducci
    Oct 18, 2005
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    545
    Bullschmidt
    May 11, 2004
Loading...

Share This Page