CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: C++ problem with sending keystrokes

    Quote Originally Posted by Doomy View Post
    keybd_event(0x25, 0, 0, 0);
    keybd_event(0x25, 0, KEYEVENTF_KEYUP, 0);
    there, does that help in any way? i doubt it.
    Sure it helps.
    At least it shows that you are NOT sending '%'. According to MSDN:
    VK_LEFT 0x25 LEFT ARROW key
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: C++ problem with sending keystrokes

    Good catch, Vlad!
    Victor Nijegorodov

  3. #18
    Join Date
    Apr 1999
    Posts
    27,449

    Re: C++ problem with sending keystrokes

    Quote Originally Posted by Doomy View Post
    keybd_event(0x25, 0, 0, 0);
    keybd_event(0x25, 0, KEYEVENTF_KEYUP, 0);
    there, does that help in any way?
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    Where do you see in the documentation above that 0x25 is the "%" key? The virtual key code you're sending is the left-arrow. So your program behaves exactly as expected.

    Secondly, the "%" is a shifted-5 key. So how are you sending the shift-key? I have never used keybd_event, but as you can see, you need to distinguish between a shifted key and non-shifted key.
    i doubt it.
    A bit of advice -- too many times, people believe their code is either not relevant to the problem, or think that their code is OK. Then what winds up happening is that when the code is posted late in the game, we see that the code was not correct. We could have saved a lot of time if you had posted the erroneous code much earlier, preferably in your first post.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; August 9th, 2011 at 09:55 AM.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured