锁住鼠标的的api有吗?
如何在vb里实现像按键精灵“LockMous”这样的命令
按键精灵“LockMous”这样的命令就是让物理鼠标没反应,但用api 例如 SetCursorPos这个api还是可以自由操作鼠标
需要什么api
喜欢vb的进来分享一下经验
[解决办法]
api不知道,把鼠标扔了不就行了?
[解决办法]
可以限制鼠标在一定范围内移动
'标准模块Option ExplicitPublic Declare Function ClipCursor Lib "user32" (lpRect As Any) As LongPublic Declare Function ClipCursorClear Lib "user32" Alias "ClipCursor" (ByVal lpRect As Long) As LongDeclare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As LongType RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypeType POINTAPI X As Long Y As LongEnd TypePublic RetValue As LongPublic ClipMode As BooleanPublic Sub SetCursor(ClipObject As Object, Setting As Boolean) ' used to clip the cursor into the viewport and ' turn off the default windows cursor Dim CurrentPoint As POINTAPI Dim ClipRect As RECT If Setting = False Then ' set clip state back to normal RetValue = ClipCursorClear(0) Exit Sub End If ' set current position With CurrentPoint .X = 0 .Y = 0 End With ' find position on the screen (not the window) RetValue = ClientToScreen(ClipObject.hwnd, CurrentPoint) ' designate clip area With ClipRect .Top = CurrentPoint.Y .Left = CurrentPoint.X .Right = .Left + ClipObject.ScaleWidth .Bottom = .Top + ClipObject.ScaleHeight End With ' clip it RetValue = ClipCursor(ClipRect)End Sub'窗体代码Option ExplicitPrivate Sub Form_Load() Picture1.ScaleMode = 3End SubPrivate Sub Picture1_Click() ClipMode = Not ClipMode SetCursor Picture1, ClipModeEnd Sub