Per bloccare il mouse in una form:
in un modulo
in command button per bloccarlo
in command button per sbloccarlo
Cmq conviene impostare la form con BorderStyle = 3 - fixed dialog affinchè la form nn si possa ridimensionare...perchè quando si ridimensiona il cursore si sblocca...
Fonte: web
in un modulo
01.
Type RECT
02.
Left As Long
03.
Top As Long
04.
Right As Long
05.
Bottom As Long
06.
End Type
07.
08.
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
09.
Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
10.
Declare Function GetDesktopWindow Lib "user32" () As Long
11.
Sub LockCursor(ByVal Locked As Boolean)
12.
Dim myform As RECT
13.
Dim desktop As RECT
14.
15.
If Locked Then
16.
GetWindowRect Form1.hwnd, myform
17.
ClipCursor myform
18.
Else:
19.
GetWindowRect GetDesktopWindow, desktop
20.
ClipCursor desktop
21.
End If
22.
23.
End Sub
in command button per bloccarlo
1.
LockCursor (True)
in command button per sbloccarlo
1.
LockCursor (False)
Cmq conviene impostare la form con BorderStyle = 3 - fixed dialog affinchè la form nn si possa ridimensionare...perchè quando si ridimensiona il cursore si sblocca...
Fonte: web