sto provando questa soluzione ma non mi fa nesun effetto

inserisco un modulo con qusto codice

Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long

Public Sub DisableTrap(CurForm As Form)
Dim erg As Long
Dim NewRect As RECT
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, LimAlt As Integer, LimLarg As Integer)
Dim X As Long, Y As Long, erg As Long
Dim NewRect As RECT

X& = Screen.TwipsPerPixelX
Y& = Screen.TwipsPerPixelY

Alto = CurForm.Top + LimAlt
sinistra = CurForm.Left + LimLarg
Larghezza = Screen.Width - CurForm.Left + LimLarg
Altezza = Screen.Height - CurForm.Top + LimAlt

With NewRect
.Left = sinistra / X&
.Top = Alto / Y&
.Right = Larghezza / X&
.Bottom = Altezza / Y&
End With
erg& = ClipCursor(NewRect)
End Sub




e nel form_resize non so cosa scrivere

ho provato cosi ....


If Me.ScaleX(scala, 1, 3) < 800 And (Me.WindowState <> vbMinimized) Then
EnableTrap Me, Me.Height + 10, Me.Width + 10
' Me.Width = Me.ScaleX(800, 3, 1)
' Me.Left = (ScaleX(getAreaSchermo, 3, 1) - Me.Width) / 2

Else
DisableTrap Me
End If

scala = Me.Height
If Me.ScaleY(scala, 1, 3) < 300 And (Me.WindowState <> vbMinimized) Then
EnableTrap Me, Me.Height + 10, Me.Width + 10
' Me.Height = Me.ScaleY(300, 3, 1)


' Else
DisableTrap Me
End If


ma non mi da nessun effeto


vorrei disabilitare il mouse per 3 secondi