|
-
Mar 11th, 2010, 01:31 PM
#1
Thread Starter
Member
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
-
Mar 11th, 2010, 01:43 PM
#2
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?
-
Mar 11th, 2010, 05:16 PM
#3
Thread Starter
Member
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?
-
Mar 11th, 2010, 09:58 PM
#4
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.
-
Mar 12th, 2010, 07:57 AM
#5
Thread Starter
Member
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.
-
Mar 12th, 2010, 11:07 AM
#6
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.
-
Mar 13th, 2010, 05:47 AM
#7
Thread Starter
Member
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?
-
Mar 13th, 2010, 06:15 AM
#8
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|