Option Explicit Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End TypePrivate Sub Command1_Click() Dim r As RECT Timer1.Enabled = False r.Left = 0 r.Top = 0 r.Bottom = Screen.Height r.Right = Screen.Width ClipCursor r End SubPrivate Sub Form_Load() Timer1.Interval = 1 Command1.Caption = "恢复" End SubPrivate Sub Timer1_Timer() Dim r As RECT GetWindowRect Me.hwnd, r ClipCursor rEnd Sub
If X > Me.Width Or Y < Me.Height Then MDI窗体或者其它窗体.Enabled = False End If
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate Sub Command1_Click()
Dim r As RECT
Timer1.Enabled = False
r.Left = 0
r.Top = 0
r.Bottom = Screen.Height
r.Right = Screen.Width
ClipCursor r
End SubPrivate Sub Form_Load()
Timer1.Interval = 1
Command1.Caption = "恢复"
End SubPrivate Sub Timer1_Timer()
Dim r As RECT
GetWindowRect Me.hwnd, r
ClipCursor rEnd Sub
MDI窗体或者其它窗体.Enabled = False
End If