1个回答
展开全部
'画两个按钮,使用如下代码
Option Explicit
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Type POINT
x As Long
y As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT)
Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT)
Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
Private Sub Form_Load()
Command1.Caption = "限制"
Command2.Caption = "解除"
End Sub
Private Sub Command1_Click()
Dim client As RECT
Dim upperleft As POINT
Dim hWnd As Long
'查找标题为“form1”的窗口
hWnd = FindWindow(vbNullString, "Form1")
GetClientRect hWnd, client
upperleft.x = client.left
upperleft.y = client.top
ClientToScreen hWnd, upperleft
OffsetRect client, upperleft.x, upperleft.y
ClipCursor client
End Sub
Private Sub Command2_Click()
ClipCursor ByVal 0&
End Sub
Private Sub Form_Unload(Cancel As Integer)
ClipCursor ByVal 0&
End Sub
Option Explicit
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Type POINT
x As Long
y As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT)
Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT)
Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
Private Sub Form_Load()
Command1.Caption = "限制"
Command2.Caption = "解除"
End Sub
Private Sub Command1_Click()
Dim client As RECT
Dim upperleft As POINT
Dim hWnd As Long
'查找标题为“form1”的窗口
hWnd = FindWindow(vbNullString, "Form1")
GetClientRect hWnd, client
upperleft.x = client.left
upperleft.y = client.top
ClientToScreen hWnd, upperleft
OffsetRect client, upperleft.x, upperleft.y
ClipCursor client
End Sub
Private Sub Command2_Click()
ClipCursor ByVal 0&
End Sub
Private Sub Form_Unload(Cancel As Integer)
ClipCursor ByVal 0&
End Sub
百事牛
2024-10-22 广告
2024-10-22 广告
百事牛是共享提供商,我们提供可靠有效的服务,适当合理的授权费有利于的继续更新优化。同样的事情,同样的方法,百事牛团队十年磨一剑,始终至聚焦在密码恢复领域,深耕于此,我们已研制出有别于其他公司的算法和运算模式, 百事牛的暴力模式加入了分布式点...
点击进入详情页
本回答由百事牛提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询