Per bloccare il mouse in una form:

in un modulo

Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
   
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
Sub LockCursor(ByVal Locked As Boolean)
Dim myform As RECT
Dim desktop As RECT

    If Locked Then
        GetWindowRect Form1.hwnd, myform
        ClipCursor myform
    Else:
        GetWindowRect GetDesktopWindow, desktop
        ClipCursor desktop
    End If

End Sub


in command button per bloccarlo

LockCursor (True)


in command button per sbloccarlo

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...