Solved

Access IE History file from VB

Posted on 1998-10-19
5
180 Views
Last Modified: 2012-05-05
Does anyone know how to pull a history listing from IE 4.x using VB?
0
Comment
Question by:red_eye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
gencross earned 200 total points
ID: 1440692
You need to use API Registry calls to do this.  The history of IE pages is under
HKEY_CURRENT_USER "Software\microsoft\Internet Explorer\TypedURLs"

The easiest way to do this would be to enumerate the keys (Url1) and the values (www.microsoft.com).  This will put all values and keys into a double dimensioned variant array.  You can get at them from there.  

I have a class that will do exactly what you are looking for, and a lot more if you would like it.  Here are a list of the API registry declares.  You won't need all of these to do what you want to do, but here they are.

Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" _
        (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
        ByVal samDesired As Long, phkResult As Long) As Long

Private Declare Function RegSetValueEx Lib "advapi32" Alias "RegSetValueExA" _
        (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
       ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long

Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" _
        (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
       ByRef lpType As Long, ByVal szData As String, ByRef lpcbData As Long) As Long

Private Declare Function RegCreateKeyEx Lib "advapi32" Alias "RegCreateKeyExA" _
        (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, _
       ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, _
       lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, _
       lpdwDisposition As Long) As Long

Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" _
        (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, _
       lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, _
       lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long

Private Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" ( _
       ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, _
       ByVal cbName As Long) As Long

Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" _
        (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, _
       lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, _
       ByVal lpData As String, lpcbData As Long) As Long

Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" _
        (ByVal hKey As Long, ByVal lpSubKey As String) As Long

Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _
        (ByVal hKey As Long, ByVal lpValueName As String) As Long

0
 
LVL 4

Expert Comment

by:gencross
ID: 1440693
Is this what you are looking for?  I might have misunderstood.
0
 

Author Comment

by:red_eye
ID: 1440694
The typed URL history would be of help but what I am also looking for is access to the URL history in the C:\windows\history folder. Any ideas on this? I am sorry I wasnt more clear with my question. I have increased the points to 175.
0
 
LVL 4

Expert Comment

by:gencross
ID: 1440695
I think this might be what you are looking for.  This code will pull all urls out of the index.dat file in the c:\windows\history folder and print them in the debug window.  You can put them in an array or whatever.  You can modify this code if you need to get into the other dat files in that directory, but this one should be all you need.

Put this code in form load or button click or something...

Dim displacement As Integer
Dim dta As String
Dim i As Long
Dim j As Long

displacement = 119

Open "c:\windows\history\index.dat" For Binary As #1

dta = Space$(LOF(1))

Get #1, , dta

Close #1

i = InStr(i + 1, dta, "URLS ")

While i < Len(dta)
 
  If i > 0 Then
    j = InStr(i + displacement - 1, dta, Chr$(0))
    Debug.Print Mid$(dta, i + displacement, j - (i + displacement))
'  If i = 372481 Then Stop
  End If
 
  i = InStr(i + 1, dta, "URL ")
 
  If i = 0 Then End
 
Wend

End

I hope this is the correct answer.  If not then let me know.
0
 

Author Comment

by:red_eye
ID: 1440696
PERFECT! Thank you very much! That is exactly what I was looking for. I bumped the point total to 200 for providing the actual working code which will be a great base to work from!! I will keep you in mind when the app goes into beta to see if you are interested in testing it. Thanks again!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month7 days, 17 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question