Hi all,

I would like to be able to show all the websites visited on a machine.

How would i go about doing this.

Thanks

When I need to get them, I do that

ComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
            ComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllUrl

I don't know, what done behind the scene, but your question will le me work around this, thanks a lot :)

I presume i need to use Imports System.Windows.Forms to get that to work.

I was originally just looking to get the *.html from temp internet then i was thinking about reading them from the registry in vista under
local_user\software\microsoft\internet explorer\typedurls

Play with registry... and I assumed it as Windows-based application.

What's interesting here, is that both methods are pretty great..... but neither one of them gets the typed URL's of a browser other than IE. What about getting the history of Firefox.... Opera.... Chrome?

i am just using IE as i have IE on the machine i am using vb.net from

I was thinking of trying something along the lines of this

Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            counter += 1
        End While
        Return urlList
    End Function

Well, That code works... And Pretty Well.

Not that I'm doing a project like this but you questioned about Firefox URL's etc Comatose, would the method to do that be similar but adding those registry locations to the list or would there be something different to do those?

You would have to do something entirely different. Firefox stores it's URL's in files.... I believe under something like "c:\documents and settings\%username%\Application Data\Mozilla\Firefox\Profiles\<somenumberhash>\history.dat" although now, I think they store it in an sqlite database (same path), making it that much more complicated to read.

right changed a bit so i can now get the urls to populate in a combobox.

Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms

Public Class Form1

    Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            ComboBox1.Items.Add(url)
            counter += 1
        End While
        Return urlList
    End Function

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

Is that code okay or would there be a better way to find viewed websites?

That code is fantastic. The only thing that I would mention about it... is that you are using the function to work with your form. On a small scale project, this is fine (and I've seen it used on large scale projects too), but keep in mind that this defeats the entire purpose of a function. Why even use a function... why not put all that code in the Button1_Click Event? The function is meant to be used to GET the list of URL's.... actually displaying them to the user is a different process... a different concept. So getting the data, and showing the data should not be combined.

Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms

Public Class Form1

    Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            counter += 1
        End While
        Return urlList
    End Function

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     dim urls as new List(of string)()
     dim I as integer
     urls =  PopulateUrlList()

     for  I = 0 to urls.count -1 ' maybe i = 1 to urls.count
            ComboBox1.Items.Add(url)          
     next I
    End Sub
End Class

i am only using it in a small program, but if i try your code i get (collection) a load of times in the combo box. Also it says
ComboBox1.Items.Add(urls)
url is not defined so i assume it meant to be urls

i am only using it in a small program, but if i try your code i get (collection) a load of times in the combo box. Also it says
ComboBox1.Items.Add(urls)
url is not defined so i assume it meant to be urls

correct, he used url in the first part and urls in the second, it should probably be

ComboBox1.Items.Add(urls)

ah yeah i changed it to urls before hand and thats when i get (collection) numerous times in the combo box.

I'm not 10% of the programmer these other guys are, but what I do at this point is insert a breakpoint and step through the code to see where the disconnect is.

No No, It was faulty code :$:

dim urls as new List(of string)()
dim I as integer
urls =  PopulateUrlList()

for  I = 0 to urls.count -1 ' maybe i = 1 to urls.count
     ComboBox1.Items.Add(urls(i))   ' // oops!
next I

cool thats sorted it comatose.

Thanks alot.

What's interesting here, is that both methods are pretty great..... but neither one of them gets the typed URL's of a browser other than IE. What about getting the history of Firefox.... Opera.... Chrome?

I know and If you were making your own IE then that would work because the Webbrowser control is basicly IE.

Please don't post to threads this old . . .

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.