Get Ie url from vb app

thorst

New member
Joined
Oct 24, 2006
Messages
4
Programming Experience
Beginner
Ill start off by saying I wasnt sure where to post in this forum so I hope i Picked the right spot. It looked like this is where most people post. Now to the question:

Im making a program that will look at your Ie (internet explorer) pages that you have open, Then decide which one is your active window (or last looked at) and then give you the source of the page. The code i have below will give you a list of all the pages that you have open when you click the button. (ex. www.google.com and www.yahoo.com and vbdotnetforums.com come up right now) It will display the current sites open in a list. My question is that i would like it to only display the CURRENT url in the list.


Imports SHDocVw

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim ie As InternetExplorer

ListBox1.Items.Clear()

For Each ie In New ShellWindows()
ListBox1.Items.Add(ie.LocationURL)
Next

End Sub


So instead of google yahoo and vbdotnetforums in the list i should only see vbdontnetforums. I have some other code I got off another site that will do it. The problem is that its disturbingly long and using the method i have done thus far is a lot shorter way of doing it. I know there has to be a way to get the current page using what I have and any help would be appriciated.

Thanks,
Thorst




 
Back
Top