using GetKeyAsyncState

This is a discussion on using GetKeyAsyncState within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to learn how GetAsyncKeyState works. With this code when escape is pressed it's suppose to break out of ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    using GetKeyAsyncState

    I'm trying to learn how GetAsyncKeyState works. With this code when escape is pressed it's suppose to break out of the loop, but it doesn't. Why not? In a GUI App would I put this in my message loop?
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main(void)
    {
       while(1)
       {
          if(GetAsyncKeyState(VK_ESCAPE))
          {
             break;
          }
       }
       return 0;
    }
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    GetAsyncKeyState will not work in a DOS application. You need to have a message loop.

Popular pages Recent additions subscribe to a feed

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