473,379 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How to 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
Feb 9 '06 #1
1 7822
Okay, I've switched to IHTMLDocument2 and it has the Navigate method.
But when I go pass it a URL, it doesn't do anything.

Help?

Ryan Faricy wrote:
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

Feb 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: guy | last post by:
Hi all - And apologies if I'm in the wrong newsgroup. I'm a newbie here and I'd certainly appreciate any pointers to the right forum. To the point... We're running a WebBrowser object...
1
by: Husam | last post by:
Hi EveryBody: I used the sendMessage function to change the url of internet Explorer to www.yahoo.com and here what I did : SendMessage(hWnd, WM_SETTEXT, 0, "http://www.yahoo.com/") but I...
7
by: husamal_ahmadi | last post by:
Hi everyBody: I have this question which really drive me cruzy, By using VB.Net: How can I let the internet explorer navigate in the same window either by using win32 API or by using...
1
by: mb | last post by:
Hi, I picked up this JavaScript code (quiz code) at: http://javascript.internet.com/miscellaneous/multiple-choice-quiz.html and modified it (and may have deleted some line I shouldn't have) so...
0
by: senthilnathan1985 | last post by:
Hi, i'm trying to develop a internet browser some thing like the one in http://www.codelifter.com/main/javascript/accentbrowser1.html. i have developed an internet browser something similar to...
6
by: sadegh | last post by:
Hi I have a problem with my program in VC++6 When I compile it, the following errors are listed. I spend a lot of time on the groups.google.com to find its reason, but none of comments could...
1
by: =?Utf-8?B?VCBSYXkgSHVtcGhyZXk=?= | last post by:
I have an ASP.NET 2.0 web app using forms authentication and an ASP.NET Membership database. Internal users access the app from the intranet, but they are authenticated by the membership module....
10
by: Stefan Weber | last post by:
Hi, I'm trying to access the JavaScript code contained in a <scripttag via its "text" attribute. This works well, if the code is embedded in the HTML page. However, when the code is in an...
4
by: remya1000 | last post by:
i'm using VB.NET 2003 Application program. i need to get External IP Address (internet). i searched internet and found come codes and tried that... i tried this code... but it returned my internal...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.