vb 锁定鼠标到某一位置

来源:互联网 发布:ios10屏幕录像软件 编辑:程序博客网 时间:2024/05/11 09:47

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

 

Private Sub Command1_Click() '锁定鼠标 到某一位置
    Dim r As RECT
    r.Left = 100: r.Top = 100
    r.Right = 100: r.Bottom = 100
    ClipCursor r
End Sub

 

Private Sub Command2_Click() '解除锁定
    ClipCursor ByVal 0&
End Sub

'原帖地址:

http://fy5388.blog.163.com/blog/static/5649953720091127115554104/

原创粉丝点击