Results 1 to 8 of 8

Thread: SHDocVw.InternetExplorer

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    62

    SHDocVw.InternetExplorer

    Hi guys,

    Another query on the internetExplorer instance i'm using.

    Up until now, i've been using webBrowser controls, but i've run up against a JSP issue which i just cannot seem to fix.

    So i've begun using SHDocVw.InternetExplorer controls. Now i have a couple of issues with this method.

    1) I can't seem to access the .document within the control (which i have instanced as 'IE').
    Code:
        Public IE As SHDocVw.InternetExplorer
    
    ....
    
    
            Dim HTMLDoc As HtmlDocument
            
            IE.visible = True
            HTMLDoc = IE.Document
    
            MsgBox(HTMLDoc.Body.InnerText)
    Any ideas or suggestions?


    2) Is there anyway to dock or embed the InternetExplorer instance within a form on the application?

    Thanks in anticipation

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: SHDocVw.InternetExplorer

    You don't want to use SHDocVw.InternetExplorer, you want to use the COM based browser control.

    However I would first ask what exactly was your issue with the managed browser and JSP?

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    62

    Re: SHDocVw.InternetExplorer

    When using the business JSP site (which is mandatory and unmodifiable) within the WebBrowser control, there is a button on the site which takes the user back to the results of their filter search in the Main Frame. In IE, this works perfectly, but in WebBrowser, it produced a blank white page in the main frame. All other work sites are fine. Just that this one is the only one in JSP and it is the only one which doesn't work

    Do you have any more information on the COM browser? link to an MSDN article?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: SHDocVw.InternetExplorer

    Add the COM Web Browser control to your Toolbox and then add an instance to your form just like you do any other control. You'll then see what type it is.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    62

    Re: SHDocVw.InternetExplorer

    I'm trying to add in the reference for the COM Web Browser, but i cannot find it. Where is it located?

    Is it under "Choose Items..."?

    I can find the Microsoft Web Browser, ieframe.dll, but this doesn't seem to load pages.

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: SHDocVw.InternetExplorer

    yes the ieframe.dll is what you want. Once you add it to the toolbox you can drag an instance to your form and use it like the managed browser control, except it has more functionaility.

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    62

    Re: SHDocVw.InternetExplorer

    Ok, now using the ieframe browser. I cast the document to a HTML document variable called 'content'. My error handler now throws this up:

    ---------------------------
    GLS Office Suite
    ---------------------------
    Please report this error: "Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to class type 'System.Windows.Forms.HtmlDocument'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface." to Martin Whitehurst.
    ---------------------------
    OK
    ---------------------------


    See my code below:

    Code:
            On Error GoTo main_handler
            Dim content As HtmlDocument
    
            text2 = "0"
    
    
    
            content = wb_GLS1.Document
            MsgBox(content.Body.InnerText)
    
            Dim t = content.Body.InnerText
    Is this the correct way of referencing the contents of the browser control?

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: SHDocVw.InternetExplorer

    You are no longer using the WinForms WebBrowser control, so it's Document property is not a WinForms HtmlDocument. You're using an ActiveX control that was created long before the WinForms HtmlDocument class existed. You have to work with the types you've got. The error message says that the Document property is of type mshtml.HTMLDocumentClass, so that's the type you need to use. It's an unmanaged control, so you need to work with unmanaged, i.e. non-.NET, types. You should check out the documentation for MSHTML on MSDN.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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