redirect web page from vb if I have window handle 
Author Message
 redirect web page from vb if I have window handle

Dear all,

If I have IE already opened and got the handle of this
browser. Is it possible I can reuse it by API function
call with this handle or any other VB function in order to
navigate to another page? I only know how to open a new
instance of browser and go to specified URL.

Thanks!

Rice



Sat, 01 Jan 2005 16:34:59 GMT  
 redirect web page from vb if I have window handle
Hello,

Thank you for using the Microsoft Newsgroups.

It's not needed to get the window handle of IE. Instead, the ShellWindows
collection is described in the Internet Client SDK as follows: The
ShellWindows object represents a collection of the open windows that belong
to the shell. In fact, this collection contains references to Internet
Explorer as well as other windows belonging to the shell, such as the
Windows Explorer.

So, you can get a reference to a specific instance of InternetExplorer.
Then, you can call its Navigate method.

The following code enumerate all InternetExplorer and navigate to your URL.

To use the following code, please add a reference to "Microsoft Internet
Controls" (Shdocvw.dll) and "Microsoft HTML Object Library" (Mshtml.dll) to
the Visual Basic project:

Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Dim Doc

   For Each IE In SWs
      Set Doc = IE.Document
      If TypeOf Doc Is HTMLDocument Then
         'if this is an HTML page, navigate.
         'you can have your condition checking for get a specific IE
          IE.Navigate URL
      End If
   Next
End Sub

Please feel free to let me know if you have any questions.

Best Regards,  
Kenny Zhou
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Mon, 03 Jan 2005 09:15:51 GMT  
 redirect web page from vb if I have window handle
Hello,

Thank you for using the Microsoft Newsgroups.

It's not needed to get the window handle of IE. Instead, the ShellWindows
collection is described in the Internet Client SDK as follows: The
ShellWindows object represents a collection of the open windows that belong
to the shell. In fact, this collection contains references to Internet
Explorer as well as other windows belonging to the shell, such as the
Windows Explorer.

So, you can get a reference to a specific instance of InternetExplorer.
Then, you can call its Navigate method.

The following code enumerate all InternetExplorer and navigate to your URL.

To use the following code, please add a reference to "Microsoft Internet
Controls" (Shdocvw.dll) and "Microsoft HTML Object Library" (Mshtml.dll) to
the Visual Basic project:

Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Dim Doc

   For Each IE In SWs
      Set Doc = IE.Document
      If TypeOf Doc Is HTMLDocument Then
         'if this is an HTML page, navigate.
         'you can have your condition checking for get a specific IE
          IE.Navigate URL
      End If
   Next
End Sub

Please feel free to let me know if you have any questions.

Best Regards,  
Kenny Zhou
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Mon, 03 Jan 2005 09:15:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. redirect web page from vb if I have window handle

2. redirecting a web page in ASP

3. redirect to another web page

4. Web forms redirect to another browser window

5. pass a form from web page to web page

6. pass a form from web page to web page

7. Vb .net redirect to a http 500 error page

8. Handling Events of Office XP Web Components in Windows Form

9. calling web page from windows app

10. Using windows user control on a web page

11. How to shutdown windows from a web page

12. How to launch web page in small IE window

 

 
Powered by phpBB® Forum Software