473,466 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I let the internet explorer start to navigate in the same windwo?

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 Microsoft Internet Control refreance to
my project ?

some body toled me to use ShellExcute Function in API but I tried it
and it did not work and some body give me this code :

Option Explicit
Private MyExplorer As InternetExplorer

Private Sub Command1_Click()
FirstExplorer.Navigate "www.google.com"
End Sub

Public Function FirstExplorer() As InternetExplorer
' REFERENCE Microsoft Internet Controls for:
Dim SW As ShellWindows
Dim IE As InternetExplorer

If MyExplorer Is Nothing Then

Set SW = New ShellWindows
For Each IE In SW
If TypeName(IE.Document) = "HTMLDocument" Then
Set MyExplorer = IE
Exit For
End If
Next

If MyExplorer Is Nothing Then
' If there is no Explorer open, then what?
Set MyExplorer = New InternetExplorer
End If
End If

Set FirstExplorer = MyExplorer

End Function

and alos it did not work with me, and also I used the send function as
follwoing:

Sendmessage(hwnd,WM_SETTEXT,0,"http;//www.yahoo.com/" )

and I foucs that this message set the address bar of the internet
explorer to the url but it did not start to navigate .

So finally Any hlep will be appreciate to solve this problem

Regard's

Husam

Nov 21 '05 #1
7 4478
Husamal,

You mean simple this

\\\Needs a form with a button
Private Sub Form7_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://www.Google.com"
p.StartInfo = pi
p.Start()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://msdn.microsoft.com"
p.StartInfo = pi
p.Start()
End Sub
///
I hope this helps,

Cor
Nov 21 '05 #2
"Cor Ligthert" <no************@planet.nl> schrieb:
\\\Needs a form with a button
Private Sub Form7_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://www.Google.com"
p.StartInfo = pi
p.Start()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://msdn.microsoft.com"
p.StartInfo = pi
p.Start()
End Sub
///


This will only work if Internet Explorer is configured to reuse existing
windows. Otherwise a new window will be opened.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
I agree with Herfried on that one, Cor

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #4
Crouchie,

Did I not, however when it is, than it works as asked.

:-)

Cor
Nov 21 '05 #5
<hu************@yahoo.com> schrieb:
How can I let the internet explorer navigate in the same window either
by using win32 API or by using Microsoft Internet Control refreance to
my project ?

some body toled me to use ShellExcute Function in API but I tried it
and it did not work and some body give me this code :

Option Explicit
Private MyExplorer As InternetExplorer

Private Sub Command1_Click()
FirstExplorer.Navigate "www.google.com"
End Sub

Public Function FirstExplorer() As InternetExplorer
' REFERENCE Microsoft Internet Controls for:
Dim SW As ShellWindows
Dim IE As InternetExplorer

If MyExplorer Is Nothing Then

Set SW = New ShellWindows
For Each IE In SW
If TypeName(IE.Document) = "HTMLDocument" Then
Set MyExplorer = IE
Exit For
End If
Next

If MyExplorer Is Nothing Then
' If there is no Explorer open, then what?
Set MyExplorer = New InternetExplorer
End If
End If

Set FirstExplorer = MyExplorer

End Function


Add a reference to "Microsoft WebBrowser Control", then use this code
(tested on Windows XP SP2, IE6 SP2):

\\\
Imports SHDocVw
..
..
..
Private MyExplorer As InternetExplorer

Private Sub Form1_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
FirstExplorer.Navigate("http://www.google.com/")
End Sub

Public Function FirstExplorer() As InternetExplorer
' REFERENCE Microsoft Internet Controls for:
Dim SW As ShellWindows
Dim IE As InternetExplorer
If MyExplorer Is Nothing Then
SW = New ShellWindows
For Each IE In SW
If TypeName(IE.Document) = "HTMLDocument" Then
MyExplorer = IE
Exit For
End If
Next IE
If MyExplorer Is Nothing Then

' Window not yet opened, open new window.
MyExplorer = New InternetExplorer
MyExplorer.Visible = True
End If
End If
FirstExplorer = MyExplorer
End Function

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
FirstExplorer.Navigate("http://www.activevb.de/")
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
Crouchie,

However that is the default setting

When it is in another way and want it in the same window than you are
overiding user preferences. What is not right in my opinion.

When it has to be in a new window, it is easily to do, see for that the
answer in this message

http://groups-beta.google.com/group/...b84f389d055d2b

Cor
Nov 21 '05 #7
Herfried,

Nice

:-)

Cor
Nov 21 '05 #8

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

Similar topics

3
by: gcash | last post by:
Most folks know you can start up an instance of Internet Explorer by saying "x=win32com.client.Dispatch('InternetExplorer.Application.1')" and you get a WIN32 object with a "Document" object that...
5
by: Clemens Ortwickler | last post by:
Hello Is it possible with JavaScript to prevent that a User is closing the Internet Explorer? Because it is important for me that the User pushes the cancel Button of this webapplication how can...
5
by: Adam Stirk | last post by:
Hi, I have a application that I need to create multiple new "iexplore.exe" processes (show more than once in taskmanger) and control them using the shdocvw/mshtml. I am able control Internet...
2
by: Graham | last post by:
Hi everyone I'm having a couple of problems with the Internet Explorer browser control. I'm using VS.NET 2003 on Win2k SP4 with IE6. First, let me briefly describe how it's used in my project....
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...
0
by: Husam | last post by:
Hi EveryBody: I got this decleration from msdn documntation which is: object.Navigate( _ url As String, _ _ _ _ )
11
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row...
9
by: Etayki | last post by:
Hi! I am new to VB.net and I am using the Visual Basic 2005 Express Edition I have two questions: 1. I am trying to write an application that will automate Internet Explorer and store data...
3
by: Matthew Lock | last post by:
Hello, I am automating Internet Explorer in order to do some simple automated testing of a web application. How do I invoke Javascript functions in the web page I load? I can successfully start...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.