调用api
成都创新互联-专业网站定制、快速模板网站建设、高性价比迭部网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式迭部网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖迭部地区。费用合理售后完善,十载实体公司更值得信赖。
在Visual Baisc.net中的声明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = H80000
Const WS_EX_TRANSPARENT As Integer= H20
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Private Sub Command1_Click()
SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED Or WS_EX_TRANSPARENT
End Sub
'取消鼠标穿透(一般窗体) SetWindowLong Me.hwnd, GWL_EXSTYLE, 0
'取消鼠标穿透(UpdateLayeredWindow画窗体) SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
点子界面时调用主界面相应位置的命令就可以了
Call 主界面.命令按钮的相应过程
如:有两个窗口窗口明为Form1、Form2
form1代码:
Public Sub Command1_Click() '这里要全局过程才行
MsgBox "你好!"
End Sub
Private Sub Command2_Click()
Form2.Show
End Sub
'-------------------------------------------------------
Form2代码:
Private Sub Command1_Click()
Call Form1.Command1_Click
End Sub
点Form2里的command1会调用Form1里的Command1_Click过程
网站名称:vb.net穿透点击的简单介绍
文章URL:https://www.cdcxhl.com/article8/hodcop.html
成都网站建设公司_创新互联,为您提供外贸网站建设、微信小程序、做网站、定制网站、用户体验、ChatGPT
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联