excel”确定“、“取消”对话框
举一个例子:
Public Declare Function FindWindowEx Lib “user32“ Alias “FindWindowExA“ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessage Lib “user32。 dll“ Alias “SendMessageA“ (ByVal hwnd As Long, ByVal wMsg As Long, ByVal...全部
举一个例子:
Public Declare Function FindWindowEx Lib “user32“ Alias “FindWindowExA“ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessage Lib “user32。
dll“ Alias “SendMessageA“ (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindow Lib “user32。
dll“ Alias “FindWindowA“ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const MK_LBUTTON = &H1
Sub 关闭弹出窗口()
With CreateObject(“internetexplorer。
application“)
。Visible = True
。Navigate “http://dzpb。gzzb。gd。cn/gzhy/GZ_NetZtbMis/Pages/login。
aspx?Type=4&LoginID=12438&CAID=&BiaoDuanGuid=2C7E5F30-88F5-11E1-B15E-8B374AC07E52“
Do Until FindWindow(vbNullString, “来自网页的消息“) > 0
DoEvents
Loop
winHwnd = FindWindow(vbNullString, “来自网页的消息“) ‘查找消息窗口
If winHwnd <> 0 Then ‘关闭“来自网页的消息”消息窗口
btnHwnd = FindWindowEx(winHwnd, 0, “Button“, “确定“)
SendMessage btnHwnd, WM_LBUTTONDOWN, 0, ByVal 0 ‘点击确认(按下左键)
SendMessage btnHwnd, WM_LBUTTONUP, 0, ByVal 0 ‘点击确认(松开左键)
End If
t1 = Timer
Do Until Timer > t1 + 0。
1
DoEvents
Loop
Do Until FindWindow(vbNullString, “Windows Internet Explorer“) > 0
DoEvents
Loop
winHwnd = FindWindow(vbNullString, “Windows Internet Explorer“) ‘查找消息窗口
If winHwnd <> 0 Then ‘关闭“Windows Internet Explorer”消息窗口
btnHwnd = FindWindowEx(winHwnd, 0, “Button“, “是(&Y)“)
SendMessage btnHwnd, WM_LBUTTONDOWN, 0, ByVal 0 ‘点击是(按下左键)
SendMessage btnHwnd, WM_LBUTTONUP, 0, ByVal 0 ‘点击是(松开左键)
End If
End With
End Sub
《赠人玫瑰手有余香,祝您好运一生一世,如果回答有用,请点“好评”,谢谢^_^!》。
收起