大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
调用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过程