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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable mouse for whole VB application

Status
Not open for further replies.

reecem

Programmer
Mar 11, 2002
15
0
0
BE
We have a VB6 program running on our shop floor which has been written for use without a mouse and follows strict paths through the program depending on keypress' which works fine.

The problem is that the shop floor operators now need to run other applications on these computers that require a mouse and if the operators start clicking on textboxes, etc in the wrong sequence within the VB6 program it will crash as it was designed without a mouse to be used.

Is there anyway I can disable the mouse for the whole VB6 application or just for an entire form?
 
You could just hide it from them:

Private Declare Function ShowCursor Lib "user32.dll" (ByVal bShow As Long) As Long

Private Sub Form_Load()

ShowCursor (0) ' Hide mouse cursor

ShowCursor (1) ' Show mouse cursor

End Sub
 
ps...I'd send a message that it was going to happen first and will come back on when they are done.

It hides it but is still functional in that if your cursur is over menu buttons they still highlight.

Run it and see. Put a breakpoint on:

ShowCursor (0) ' Hide mouse cursor

check it out and then hit PF8 to enable it.
 
Thanks for the info but I've already tried this solution and as you mentioned the mouse is still functional so if they click the mouse button it will get focus on which ever textbox etc that the mouse is over which will cause problems.

I really need a global disable of all mouse clicks?
 
I don't really do subclassing of Forms but suspect that it could work for you. You'd need to intercept all the mouse related messages on their way to your Form(s) and block them. Others may expand on this if it is a reasonable idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top