Virtual Keys

This is a discussion on Virtual Keys within the Windows Programming forums, part of the Platform Specific Boards category; I want to set a key press for things. I know how to do it this way... if(GetAsyncKeyState(VK_F2)) { MY ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    55

    Virtual Keys

    I want to set a key press for things. I know how to do it this way...

    if(GetAsyncKeyState(VK_F2)) {
    MY CODE
    }

    Now how would I get it to do LCtrl + F2? would it be something like

    if(GetAsyncKeyState(VK_LCONTROL & VK_F2)) {
    MY CODE
    }

    Something like that? Or am I going about it all wrong?

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Use two calls to GetAsyncKeyState, one for each key.
    Code:
    if (GetAsyncKeyState(KEY1) && GetAsyncKeyState(KEY2))

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    55
    Perfect! Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. Resetting virtual keys
    By WalkerBurgin in forum Windows Programming
    Replies: 2
    Last Post: 08-18-2004, 10:31 PM
  3. virtual keys, while loop, movement
    By PHP in forum C++ Programming
    Replies: 3
    Last Post: 12-24-2002, 01:57 PM
  4. C++ XML Class
    By edwardtisdale in forum C++ Programming
    Replies: 0
    Last Post: 12-10-2001, 10:14 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21