Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing a mouse click??

Status
Not open for further replies.

goatsaregreat

Programmer
Mar 21, 2001
82
GB
I need to be able to force a left-click. I want it so that even if I right-click, it is registered as a left-click. Thenks for the prompt help!! :)
 
If you want this to happen for your application that you wrote, you can subclass the control or form to trap and discard certain messages like the wm_lbuttonclick (something like that).

You could also ignore it in the mouse down event.

Also, do a search on the SetKeyboardState api. I believe there are related functions that may help you.
 


Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' execute events
End Sub

Button is the vari. for the mouse 1 = left, 2 = right.

Jon
 
I knew that the "Button" parameter was for the mouse, but I can't get anything to work. For instance, I have a grid that I want to register a left-click, no matter what. I can't seem to get it to register a left if I right-click. Does that make sense? I have tried

If button = 2 then button = 1

but this line of code, when placed in the mousedown event is too late. It is already registered as a right-click. :-( TIA for your continued help.
 
Does the same thing happen with _Click() event when no arguments are passed ?

Jon

P.S. what grid are you using ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top