Here is how to check the mouse button 'up_or_down' status.
Declare Function GetKeyState Lib "user" (ByVal k%) As Integer
Declare Function GetAsyncKeyState Lib "user" (ByVal k%) As Integer
This functions will tell you whether a key is up or down, and if it's "toggled". The high order bit tells you if the key is up or down. The low order bit tells you if it's toggled - each time the key is pressed and then released the low order bit will change.
The first function maintains the keyboard state when the last *window message* was received by the app and is the one you normally use. The second one corresponds to the real time keyboard state.
Now, why on earth do I talk keyboard when the question was about the mouse? - That's because the mouse buttons are considered as "virtual" keyboard keys. Some virtual key codes are:
VK_LBUTTON 1
VK_RBUTTON 2
VK_MBUTTON 4
VK_TAB 9
VK_ESCAPE 27
So to wait for the left mouse button to be first pressed and then released you could use:
Do While GetKeyState(VK_LBUTTON)>=0: DoEvents: Loop
Do While GetKeyState(VK_LBUTTON)<0: DoEvents: Loop
|