locked
Get Info from IE and Outlook RRS feed

  • Question

  • I am looking to write a vb program that will get the following info from IE each time a new page begins to load:

     

    1. What is the URL of the page being loaded

    2. What is the IP of the server it is getting the page from

    3. What is the source of the page

     

    I also am looking to get Outlook message contents (source) when a new message is opened.

     

    I have so far only see threads about IE Automation but are C# specific, hoping to do this with VB .NET

     

    Thanks for your help.

    Sunday, January 27, 2008 5:27 PM

Answers

  • Hi Ryan,

     

    Based on your post, you need to know the url of the opened websites.

     

    You can use the following code snippet to get the information of the website which is currently opened by using IE. You need to add the reference to ms internet control and mshtml library. You can use the Timer component to check the current openging webpage timingly to get the url and html content. You can use System.Dns class to parse the server's IP address for your use. For more information about connecting IE, visit http://support.microsoft.com/kb/176792. Hope this helps.

    Code Block

    Imports mshtml

    Public Class Form2

    Dim WithEvents IE As SHDocVw.InternetExplorer

    Dim WithEvents CurrentDoc As HTMLDocument

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

    Handles Button1.Click

    Dim SWs As New SHDocVw.ShellWindows

    Dim IEx As SHDocVw.InternetExplorer

    For Each IEx In SWs

    Try

    If TypeOf (IEx.Document) Is HTMLDocument Then

    IE = IEx

    CurrentDoc = IE.Document

    MessageBox.Show(CurrentDoc.url.ToString)

    End If

    Catch ex As Exception

    End Try

    Next

    End Sub

    End Class

     

     

    In this thread, we are mainly discussing about IE information as indicated by the your post. Since your other question is not directly related to the original IE automation issue, it would be best if you open up a new thread for the outlook question. In this way, our discussion here will not deviate too much from the main issue. This will make answer searching in the forum easier and be beneficial to other community members as well. Thank you for your understanding.

     

    Best regards,

    Riquel

    Thursday, January 31, 2008 7:08 AM

All replies

  • Don't tell me I stumpped all you guru programmers out there...

    Monday, January 28, 2008 7:46 AM
  • I'm sure this is possible, its just a question of how.

    Wednesday, January 30, 2008 6:42 PM
  • Hi Ryan,

     

    Based on your post, you need to know the url of the opened websites.

     

    You can use the following code snippet to get the information of the website which is currently opened by using IE. You need to add the reference to ms internet control and mshtml library. You can use the Timer component to check the current openging webpage timingly to get the url and html content. You can use System.Dns class to parse the server's IP address for your use. For more information about connecting IE, visit http://support.microsoft.com/kb/176792. Hope this helps.

    Code Block

    Imports mshtml

    Public Class Form2

    Dim WithEvents IE As SHDocVw.InternetExplorer

    Dim WithEvents CurrentDoc As HTMLDocument

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

    Handles Button1.Click

    Dim SWs As New SHDocVw.ShellWindows

    Dim IEx As SHDocVw.InternetExplorer

    For Each IEx In SWs

    Try

    If TypeOf (IEx.Document) Is HTMLDocument Then

    IE = IEx

    CurrentDoc = IE.Document

    MessageBox.Show(CurrentDoc.url.ToString)

    End If

    Catch ex As Exception

    End Try

    Next

    End Sub

    End Class

     

     

    In this thread, we are mainly discussing about IE information as indicated by the your post. Since your other question is not directly related to the original IE automation issue, it would be best if you open up a new thread for the outlook question. In this way, our discussion here will not deviate too much from the main issue. This will make answer searching in the forum easier and be beneficial to other community members as well. Thank you for your understanding.

     

    Best regards,

    Riquel

    Thursday, January 31, 2008 7:08 AM
  • Thanks.  One last IE Automation question.  How would I pause then resume navigation to a site or if thats not possible stop then restart navigation to a site with ie?

    Thursday, January 31, 2008 6:57 PM
  • Hi Ryan,

     

    In this scenario We can use SHDocVw.InternetExplorer methods to implement this. There are Stop, Quit and Navigate methods to use. We can use these methods to close the specific webpage and open a new webpage. Hope this helps.

     

    Best regards,

    Riquel

    Friday, February 1, 2008 8:41 AM
  • Hi Riquel,

    Could you indicate to dummies users like me an ad application to internet explorer that implements that the ryan describe?! Save navigation states to resume later?! Its were intersting if we cold save more than one state...

    Thanks.

    Monday, February 4, 2008 1:02 AM