展开全部
Option Explicit
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function ClipCursorBynum& Lib "user32" Alias "ClipCursor" (ByVal lpRect As Long)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim mouse As RECT
Private Sub Command1_Click()
mouse.Left = Me.Left / Screen.TwipsPerPixelX
mouse.Top = Me.Top / Screen.TwipsPerPixelY
mouse.Right = (Me.Left + Me.Width) / Screen.TwipsPerPixelX
mouse.Bottom = (Me.Top + Me.Height) / Screen.TwipsPerPixelY
ClipCursor mouse
End Sub
Private Sub Command2_Click()
ClipCursorBynum 0
End Sub
Private Sub Command3_Click()
ClipCursorBynum 0
Unload Me
End Sub
Private Sub Form_Load()
Command1.Caption = "限制鼠标"
Command2.Caption = "解除限制"
Command3.Caption = "退出"
End Sub
Private Sub Form_Terminate()
ClipCursorBynum 0
Unload Me
End Sub
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function ClipCursorBynum& Lib "user32" Alias "ClipCursor" (ByVal lpRect As Long)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim mouse As RECT
Private Sub Command1_Click()
mouse.Left = Me.Left / Screen.TwipsPerPixelX
mouse.Top = Me.Top / Screen.TwipsPerPixelY
mouse.Right = (Me.Left + Me.Width) / Screen.TwipsPerPixelX
mouse.Bottom = (Me.Top + Me.Height) / Screen.TwipsPerPixelY
ClipCursor mouse
End Sub
Private Sub Command2_Click()
ClipCursorBynum 0
End Sub
Private Sub Command3_Click()
ClipCursorBynum 0
Unload Me
End Sub
Private Sub Form_Load()
Command1.Caption = "限制鼠标"
Command2.Caption = "解除限制"
Command3.Caption = "退出"
End Sub
Private Sub Form_Terminate()
ClipCursorBynum 0
Unload Me
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询