Results 1 to 4 of 4

Thread: How do I NAVIGATE an external Internet Explorer_Server class??

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    2

    Exclamation How do I NAVIGATE an external Internet Explorer_Server class??

    I am in need of help here ... I have an application that needs to read information from an existing web browser window (located within an application I did not create). I am able to read the text from it using the IEDom tutorial seen everywhere ...

    ... but now what I need it to do is to actually navigate to a different page.

    I have attempted to create an object within my application that points to the Internet Explorer_Server class' IWebBrowser2, almost identically to the routine that gets the IHTMLDocument class so that I can read my text.

    The only problem is, when it gets to "If hr Then Throw New COMException(hr)", it (obviously) throws an exception. Everything else seems to be working great.

    I know the function shouldn't return an "Object" but rather a WebBrowser. Right? I just happened to have forgotten to change it back before I pasted it here.

    What am I doing wrong? How can I subclass another applications "Internet Explorer_Server" in order to tell it to go to a certain URI?

    Public Module IEBrowser
    Declare Function ObjectFromLresult Lib "oleacc" (ByVal lResult As Int32, ByRef riid As System.Guid, ByVal wParam As Int32, ByRef ppvObject As IHTMLDocument) As Int32
    Dim win32 As New Win32Functions()

    Public Function IEBrowserFromhWnd(ByVal hWnd As IntPtr) As Object
    Dim IID_IWebBrowser2 As System.Guid = New System.Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E")
    'Dim hWndChild As Int32
    Dim lRes As Int32
    Dim lMsg As Int32
    Dim hr As Int32
    If Not hWnd.Equals(0) Then
    If Not hWnd.Equals(0) Then
    ' Register the message
    lMsg = MDC.Win32Functions.RegisterWindowMessage("WM_HTML_GETOBJECT")
    'MsgBox(lMsg.ToString)
    ' Get the object
    Call MDC.Win32Functions.SendMessageTimeout(hWnd, lMsg, 0, 0, MDC.Win32Functions.SMTO_ABORTIFHUNG, 1000, lRes)

    If lRes Then
    ' Get the object from lRes
    hr = ObjectFromLresult(lRes, IID_IWebBrowser2, 0, IEBrowserFromhWnd)
    If hr Then Throw New COMException(hr)
    End If
    End If
    Else
    MsgBox("bad hwnd!!")
    End If
    End Function
    End Module
    Last edited by rfaricy; Feb 9th, 2006 at 03:32 AM. Reason: typos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width