|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I let the internet explorer start to navigate in the same windwo?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 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
Show quote
Hide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> schrieb: This will only work if Internet Explorer is configured to reuse existing > \\\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 > /// 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/> Crouchie,
Did I not, however when it is, than it works as asked. :-) CorCrouchie,
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/microsoft.public.dotnet.languages.vb/msg/14b84f389d055d2b Cor <husamal_ahm***@yahoo.com> schrieb:
Show quoteHide quote > How can I let the internet explorer navigate in the same window either Add a reference to "Microsoft WebBrowser Control", then use this code > 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 (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/>
arraylist copy
Easiest way to generate XML in VB.NET Excaping recursive functions Why do we need Namespace and Module? Multi-dimensional array with variable number of elements in last dimension Legacy Client <--> DotNet Listener Possible values of DTE.ActiveDocument.Kind ? How do you force a thread to run on a specific processor? Async Delegates polling for vb.net examples Unable to start debuging on the web server |
|||||||||||||||||||||||