Click to See Complete Forum and Search --> : Mouse Buttons


Xemion
December 8th, 1999, 08:48 PM
All,

Is there an API call for what mouse buttons are down and which ones are up? I know there is mousedown events in Visual Basic, but I don't want to make an event for everything if my program. I need to know if the left mouse button is down and if the right mouse buttons is down or both. Can somebody please help me?

Xemion

Ruth Glushkin
December 9th, 1999, 09:27 AM
You can use API Function GetAsyncKeyState(), with
VK_LBUTTON for left mouse button,
VK_RBUTTON for right mouse button
and VK_MBUTTON for middle mouse button,
which will give you the mouse status (which key pressed or released).

You can also check in Key_Down and Key_Up Events for
vbKeyLButton, vbKeyRButton and bvKeyMButton constants, so you don't need API.

Good Luck!

Xemion
December 9th, 1999, 01:38 PM
Thanks!!

Xemion

Xemion
December 10th, 1999, 08:34 AM
Ruth,

I have another question. Sometimes GetAynscKeyState isn't picking up my mouse clicks. I've got it check for clicks in a do loop,
sometimes is misses clicks. Would this be because the mouse button is down while it's checking for clicks? I don't understand why it's skipping them. Can you help?

Xemion

Ruth Glushkin
December 12th, 1999, 01:09 AM
It could depend on the speed of your Mouse Driver and on the speed of your Loop.
If you check the Mouse Status slower than it changes it you could miss something.
It also depend on the priority of your application, and, of course, on the Operating
System. To be sure that everything is OK, try to remember that
GetAsyncKeyState returns you 0 if mouse or key didn't pressed, 80 if it was pressed
once, 81 if it was pressed continuously and 1 if it was pressed and released.

Good Luck