ClipCursor:使滑鼠在特定的範圍內
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
  
Private Type RECT
  
 Left As Long
  
 Top As Long
  
 Right As Long
  
 Bottom As Long
  
End Type
  
Dim A As RECT
  
Private Sub Form_Load()
  
 A.Left = Me.Left \ 15
  
 A.Right = Me.Left \ 15 + Me.Width \ 15
  
 A.Top = Me.Top \ 15
  
 A.Bottom = Me.Top \ 15 + Me.Height \ 15
  
 ClipCursor A
  
End Sub
  
Private Sub Command1_Click()
  
 ClipCursor ByVal 0& '取消限制滑鼠
  
End Sub