Option Explicit
Dim ie As Object
Dim SWs As Object
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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
Private Const BM_CLICK = &HF5
Private Sub Command1_Click()
Dim i As Integer
On Error Resume Next
For Each ie In SWs
If ie.LocationURL = Combo1.Text Then
For i = 0 To ie.Document.Frames.Item(1).Document.All.length - 1
If UCase(ie.Document.Frames.Item(1).Document.All(i).tagname) = "INPUT" Then
If ie.Document.Frames.Item(1).Document.All(i).Type = "checkbox" Then
ie.Document.Frames.Item(1).Document.All(i).Checked = True
ElseIf ie.Document.Frames.Item(1).Document.All(i).Value = "签收" Then
ie.Document.Frames.Item(1).Document.All(i).Click
End If
End If
Next i
End If
Next
End SubPrivate Sub Command2_Click()
On Error Resume Next
Dim hwnd0 As Long
Dim hwnd1 As Long
hwnd0 = FindWindow(vbNullString, "Microsoft Internet Explorer")
hwnd1 = FindWindowEx(hwnd0, 0, "Button", "确定")
SendMessage hwnd1, BM_CLICK, 0, 0
End SubPrivate Sub Form_Load()
Set ie = CreateObject("InternetExplorer.Application")
Set SWs = CreateObject("Shell.Application").Windows
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
在第一个按钮将网页中的所有的全部选定后,点击“签收”网页按钮后,弹出一个
确认框,再点击“确定”按钮实现功能。现在是弹出的这个确认框,实现不了点击。请高手指点一下!qq 87755438
Dim ie As Object
Dim SWs As Object
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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
Private Const BM_CLICK = &HF5
Private Sub Command1_Click()
Dim i As Integer
On Error Resume Next
For Each ie In SWs
If ie.LocationURL = Combo1.Text Then
For i = 0 To ie.Document.Frames.Item(1).Document.All.length - 1
If UCase(ie.Document.Frames.Item(1).Document.All(i).tagname) = "INPUT" Then
If ie.Document.Frames.Item(1).Document.All(i).Type = "checkbox" Then
ie.Document.Frames.Item(1).Document.All(i).Checked = True
ElseIf ie.Document.Frames.Item(1).Document.All(i).Value = "签收" Then
ie.Document.Frames.Item(1).Document.All(i).Click
End If
End If
Next i
End If
Next
End SubPrivate Sub Command2_Click()
On Error Resume Next
Dim hwnd0 As Long
Dim hwnd1 As Long
hwnd0 = FindWindow(vbNullString, "Microsoft Internet Explorer")
hwnd1 = FindWindowEx(hwnd0, 0, "Button", "确定")
SendMessage hwnd1, BM_CLICK, 0, 0
End SubPrivate Sub Form_Load()
Set ie = CreateObject("InternetExplorer.Application")
Set SWs = CreateObject("Shell.Application").Windows
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
在第一个按钮将网页中的所有的全部选定后,点击“签收”网页按钮后,弹出一个
确认框,再点击“确定”按钮实现功能。现在是弹出的这个确认框,实现不了点击。请高手指点一下!qq 87755438
解决方案 »
- VB TreeView控件简单问题!
- 谁给看看这个问题,高手救命呀
- 怎样用VBA向Excel中添加一个Button,或者一个ComboBox ?
- 请问如何用DBList显示数据表??谢谢解答
- 怎么样实现象windows菜单文件下面的打开,保存,另存为的gon功能,用代码,我界面已经做出,
- 请问:vb中用ADO生成xml文件时遇到的问题
- 怎么使用VBSCRIPT控制DW中的层啊?例如层的ID是LAYER1,怎么在一个连接上用ONCLICK点击后显示,在点击不显示层?谢谢了啊
- 我做的进度显示为何不连续?
- 如何在VB中开发自己的DLL?
- 怎样控制Msgbox出现的位置?
- 求大侠帮助啊!vb中的运行错误呀!急…………
- 请问一个用VB开发的录音程序如何直接保存为MP3格式啊?
解决办法是通过DOM调用该button标签的click方法。
Plugin qs=Web.Htmlget("text","name:签收")
Plugin Web.Tips(qs)
Plugin Bkgnd.KeyPress(hwnd,13)
Plugin Hwndp=window.find(0,"Microsoft Internet Explorer")
Plugin Hwndc=window.findEX(hwndp,0,"button","确定")
Plugin Bkgnd.LeftClick(hwndc,35,10)
~~~~~~~~~~~~~~~~~~~~
这段程序实现了点击弹出窗口中的确定按钮。请江南春兄看一看,指点一二!