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 Sub
Private Sub Form_Load()
Set ie = CreateObject("InternetExplorer.Application")
Set SWs = CreateObject("Shell.Application").Windows
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
在第一个按钮将网页中的所有的全部选定后,点击“签收”网页按钮后,弹出一个
确认框,再点击“确定”按钮实现功能。现在是弹出的这个确认框,实现不了点击。请高手指点一下!qq 87755438

解决方案 »

  1.   

    网页中的button属于无窗口控件,根本没有hwnd,又怎么能够使用sendmessage发送消息呢。
    解决办法是通过DOM调用该button标签的click方法。
      

  2.   

    可否指点一下如何用dom调button的click方法
      

  3.   

    //处理签收时的弹出窗口
        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)
    ~~~~~~~~~~~~~~~~~~~~
        这段程序实现了点击弹出窗口中的确定按钮。请江南春兄看一看,指点一二!
      

  4.   

    没有完整的URL,我怎么帮你测试。
      

  5.   

    你弹出的空间是HTML对话框还是普通的对话框啊?
      

  6.   

    对话框还有具别的啊!我觉得该是html的对话框。