Use of the GetAsynchKeyState Function
The GetAsynchKeyState function should not be used to retrieve the state of a key or a mouse button, except when absolutely necessary. This function queries the hardware driver to determine the physical key or button state, but ignores any keys being artificially held down or simulated by accessibility aids. When possible, you should use the GetKeyState function, which correctly reflects any simulated input. GetAsynchKeyState can, however, be called in certain cases, such as when the user types a key to interrupt a lengthy processing task.
When handling mouse drag operations, you should avoid using GetAsynchKeyState to detect when a mouse button has been lifted. Instead, you should use the SetCapture function and wait for a button-up message. If you use GetAsynchKeyState, the results might differ from those obtained using other Windows functions and messages. This can cause your application to behave inconsistently with other software on the system.