估计你说的是网页对话框,模式显示那种。INewWindowManager接口可以得到这种对话框的通知,也可屏蔽,但如何操作这个对话框不知道,没尝试过

解决方案 »

  1.   

    TO bcrun:是内网的一个系统,我明天把要弹出这个窗口的页面发上来,我只能发那种在页面上面用鼠标点右键弹出来的那种“源代码”,呵呵,真正的源代码是什么只能猜了另外,TO hpygzhx520:这不是对话框,是个完善的页面,可以点“查询”可以点“新增”,功能很齐全的
      

  2.   


    目前我使用的方法是另外写个程序去搜索系统中的进程,找到相应的窗口发送按键消息或者鼠标消息来操作,可是这样的方法不够稳定不够方便。先找到该网页窗口(可以通过标题栏等查找到),然后遍历这个窗口的子窗口,找到IE窗口后,就可以对这个窗口的对像进行操作了.这个窗口中的对像是一个标准的Document对像,里面的有<Form>这种HTML控件,获得以后可以使用网页编程的方式使用javascript对其进行操作,如果要提交则调用Form1.submit()这个方法,填写表单Text1.innerText这类似的方法进行改变,总之就是在网页里的Javascript脚本.
      

  3.   

    如果你是使用webBrowser的话就更简单了,直接取webBrowser.document这个对像就行.dim htmlDoc as object
    dim htmlButton as object
    set htmlDoc =webBrowser.document
    '比如新增按钮的名字叫addNew
    set htmlButton =htmlDoc.all("addNew")
    htmlButton.Click差不多就这个意思
      

  4.   

    那个应该是个frame框架页,找到是哪个框架的,一样的用dom方法操作。你给出网址,me看下
      

  5.   

    TO wolfcapita:
    既然我在写类似于自动填表的软件,我当然会使用webBrowser操作页面,自然也会提交
    可是我的问题是这个是弹出来的窗口,在窗口里可以输入数据进行查询也可以直接点新增,我要操作弹出来的窗口总是没什么策略,获取不到这个窗口的内容而且程序在弹出窗口后什么也做不了TO sysdzw:
    确实是框架,我在框架里操作网页的各个元素也是没问题的,现在主要是弹出的窗口是一个正规的页面,弹出后我的程序什么也干不了,所以什么也获取不到,什么也不能操作
      

  6.   

    "网页里使用PopupWin的,弹出一个无法点击右键也无法选择文字的窗口"
    这个窗口的地址啥的追踪不到吗?如果没有,那是人家做的一个小应用,只能发送按键消息或者鼠标消息了
      

  7.   

    这种窗口也和普通的IE窗口一样,有hWnd,取到这个hWnd后遍历子窗口,然后取到具体的Document,操作方法同6楼所示.
      

  8.   

    具体操作:以下是标准模块ihtmlCom.basOption ExplicitPrivate Type UUID
            Data1   As Long
            Data2   As Integer
            Data3   As Integer
            Data4(0 To 7)       As Byte
      End Type
        
      Private Declare Function GetClassName Lib "user32" _
            Alias "GetClassNameA" ( _
            ByVal hWnd As Long, _
            ByVal lpClassName As String, _
            ByVal nMaxCount As Long) As Long
        
      Private Declare Function EnumChildWindows Lib "user32" ( _
            ByVal hWndParent As Long, _
            ByVal lpEnumFunc As Long, _
            lParam As Long) As Long
        
      Private Declare Function RegisterWindowMessage Lib "user32" _
            Alias "RegisterWindowMessageA" ( _
            ByVal lpString As String) As Long
        
      Private Declare Function SendMessageTimeout Lib "user32" _
            Alias "SendMessageTimeoutA" ( _
            ByVal hWnd As Long, _
            ByVal msg As Long, _
            ByVal wParam As Long, _
            lParam As Any, _
            ByVal fuFlags As Long, _
            ByVal uTimeout As Long, _
            lpdwResult As Long) As Long
                    
      Private Const SMTO_ABORTIFHUNG = &H2
        
      Private Declare Function ObjectFromLresult Lib "oleacc" ( _
            ByVal lResult As Long, _
            riid As UUID, _
            ByVal wParam As Long, _
            ppvObject As Any) As Long
        
      Private Declare Function FindWindow Lib "user32" _
            Alias "FindWindowA" ( _
            ByVal lpClassName As String, _
            ByVal lpWindowName As String) As Long
        
      '
      '   IEDOMFromhWnd
      '
      '   Returns   the   IHTMLDocument   interface   from   a   WebBrowser   window
      '
      '   hWnd   -   Window   handle   of   the   control
      '
      Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocument
      Dim IID_IHTMLDocument     As UUID
      Dim hWndChild     As Long
      Dim lRes     As Long
      Dim lMsg     As Long
      Dim hr     As Long
        
            If hWnd <> 0 Then
                    
                  If Not IsIEServerWindow(hWnd) Then
                    
                        '   Find   a   child   IE   server   window
                        EnumChildWindows hWnd, AddressOf EnumChildProc, hWnd
                          
                  End If
                    
                  If hWnd <> 0 Then
                                
                        '   Register   the   message
                        lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
                                
                        '   Get   the   object   pointer
                        Call SendMessageTimeout(hWnd, lMsg, 0, 0, _
                                        SMTO_ABORTIFHUNG, 1000, lRes)
        
                        If lRes Then
                                      
                              '   Initialize   the   interface   ID
                              With IID_IHTMLDocument
                                    .Data1 = &H626FC520
                                    .Data2 = &HA41E
                                    .Data3 = &H11CF
                                    .Data4(0) = &HA7
                                    .Data4(1) = &H31
                                    .Data4(2) = &H0
                                    .Data4(3) = &HA0
                                    .Data4(4) = &HC9
                                    .Data4(5) = &H8
                                    .Data4(6) = &H26
                                    .Data4(7) = &H37
                              End With
                                      
                              '   Get   the   object   from   lRes
                              hr = ObjectFromLresult(lRes, IID_IHTMLDocument, 0, IEDOMFromhWnd)
                                      
                        End If
        
                  End If
                    
            End If
        
      End Function
        
      Private Function IsIEServerWindow(ByVal hWnd As Long) As Boolean
      Dim lRes     As Long
      Dim sClassName     As String
        
            '   Initialize   the   buffer
            sClassName = String$(100, 0)
              
            '   Get   the   window   class   name
            lRes = GetClassName(hWnd, sClassName, Len(sClassName))
            sClassName = Left$(sClassName, lRes)
              
            IsIEServerWindow = StrComp(sClassName, _
                                                  "Internet   Explorer_Server", vbTextCompare) = 0
              
      End Function
        
      '
      '   Copy   this   function   to   a   .bas   module
      '
      Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long
              
            If IsIEServerWindow(hWnd) Then
                  lParam = hWnd
            Else
                  EnumChildProc = 1
            End If
              
      End Function
    用法:tSnapHwnd 为Spy++看到的IE窗口句柄,包括模态对话框dim tSnapHwnd as long 
    Dim tHtml As IHTMLDocument2
    Set tHtml = IEDOMFromhWnd(tSnapHwnd)
      

  9.   

    散分。
    wolfcapita的方法我会试一下的,由于那是内网的网站所以不见得是哪天才可以去研究的