Thread: GetAsyncKeyState / GetKeyState returns <0 values even after releasing the MouseButton

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    Unhappy GetAsyncKeyState / GetKeyState returns <0 values even after releasing the MouseButton

    GetAsyncKeyState / GetKeyState returns <0 values even after releasing the MouseButton. This happens only if we are trying to drop a file from my application to Another application window(eg Acrobat), but it returns 0 when i am dragging & dropping one file to an Application shortcut(eg: Acrobat shortcut icon in my desktop). Could you please help me.
    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    This is Windows-specific question.

    What do you want to read from GetAsyncKeyState? It returns two states:
    Current up/down state and on/off state (like capslock button).

    I assume you want to check whether it's up/down:

    Code:
    if (GetAsyncKeyState(VK_xxx) & 0x8000 != 0)
    {
    }


    Remember it returns short, not int.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    2
    Thanks kmdv.
    Sorry for posting in wrong place.
    my code is:
    if(GetAsyncKeyState(VK_LBUTTON) >= 0 && (GetAsyncKeyState(VK_RBUTTON) >= 0) )
    here I am checking both keys are up after dropping the file. This condition is getting passed when i am droping the file to icon & failing when i an dropping the file to the application window.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 47
    Last Post: 07-13-2010, 07:22 PM
  2. what exactlly these values returns?
    By nkrao123@gmail. in forum C Programming
    Replies: 3
    Last Post: 12-09-2009, 06:42 AM
  3. fread returns strange values
    By seaking1 in forum C Programming
    Replies: 6
    Last Post: 04-30-2009, 02:10 AM
  4. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

Tags for this Thread