|
-
Aug 4th, 2000, 01:52 AM
#1
Thread Starter
Member
I'd like to know if it's possible to lock the mouse in a form. I mean : I'd like the mouse cursor to be invisible ( i know the code ) and i'd like the user can only use the keyboard... how can i do ??
Thanks
COSIDUS
-
Aug 4th, 2000, 08:27 AM
#2
To disable the Mouse
Code:
Shell "rundll32 mouse,disable"
To Hide/Show the cursor:
Code:
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Sub Command1_Click()
'Hide the cursor
ShowCursor 0
End Sub
Private Sub Command2_Click()
'Show the cursor
ShowCursor 1
End Sub
-
Aug 26th, 2000, 10:42 AM
#3
New Member
lock one mouse button?
and how can i lock one mouse button?
i would like that only the left button works!
is that possible?
thank you...
-
Aug 26th, 2000, 11:11 AM
#4
If your form does not have a popup menu, why not try your first suggestion: lock the mouse on the form.
Code:
Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Sub DisableTrap(CurForm As Form)
Dim erg As Long
'Declare a variable for the procedure
'to set the new coordinates
Dim NewRect As RECT
CurForm.Caption = "Mouse released"
'Set the new coordinates to full screen
With NewRect
.Left = 0&
.Top = 0&
.Right = Screen.Width / Screen.TwipsPerPixelX
.Bottom = Screen.Height / Screen.TwipsPerPixelY
End With
erg& = ClipCursor(NewRect)
End Sub
Public Sub EnableTrap(CurForm As Form)
Dim X As Long, Y As Long, erg As Long
'Declare a variable for the procedure
'to set the new coordinates
Dim NewRect As RECT
'Get the TwipsperPixel
'The Form's ScaleMode must be set to Twips!!!
X& = Screen.TwipsPerPixelX
Y& = Screen.TwipsPerPixelY
CurForm.Caption = "Mouse trapped"
'Set the Cursor-Region to the coordinates
'of the form
With NewRect
.Left = CurForm.Left / X&
.Top = CurForm.Top / Y&
.Right = .Left + CurForm.Width / X&
.Bottom = .Top + CurForm.Height / Y&
End With
erg& = ClipCursor(NewRect)
End Sub
Usage:
EnableTrap Me
DisableTrap Me
'Remember, put a DisableTrap Me in the Form_Unload event.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|