J
Jim
Hello,
I am writing an application to list all the sites viewed via internet
explorer and have created the following routine to read the history files to
a temporary file which is then used by the application. It seems to work
fine for the first file in the list, but then it blows up with an invalid
argument error when attempting to execute myProcess for the second file...
can someone tell me why this is happening?
Thanks!
Jim
Sub CreateTmpFile()
' INDEXFILES is an array loaded with all filenames on the
' computer which are index.dat internet explorer history files
Dim bHidden As Boolean = False
' Display an appropriate message
lblMessage.Text = "Scanning web viewing history files ...."
Application.DoEvents()
' now for the real time saver, creating a
' unique file name in .NET
sTempFN = "SomeFile.txt"
' Show the progress bar
ProgressBar1.Maximum = UBound(IndexFiles)
' loop through all the temporary file names
For x As Integer = 1 To UBound(IndexFiles)
' set the file name and the command line args
Dim myProcess As New Process
myProcess.StartInfo.FileName = "command.com"
myProcess.StartInfo.Arguments = "/c find " + Chr(34) + "://" +
Chr(34) + " " + Chr(34) + IndexFiles(x) + Chr(34) + " >> " + Chr(34) +
sTempFN + Chr(34)
' start the process in a hidden window
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
' if the process doesn't complete within
' 20 seconds, kill it
myProcess.WaitForExit(20000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If
myProcess = Nothing
' Increment the progress bar
ProgressBar1.Value = x
Next
' Check that the temporary file exists
Dim dir As New DirectoryInfo(sTempFN)
If Not dir.Exists Then
'MsgBox("For some odd reason, " & sTempFN & " does not exist:" +
vbCrLf + vbCrLf + sTempFN + vbCrLf + vbCrLf + "Unfortunately, no surfing
history can be tracked.", vbOKOnly, "Exiting (code=0)")
End If
dir = Nothing
End Sub
I am writing an application to list all the sites viewed via internet
explorer and have created the following routine to read the history files to
a temporary file which is then used by the application. It seems to work
fine for the first file in the list, but then it blows up with an invalid
argument error when attempting to execute myProcess for the second file...
can someone tell me why this is happening?
Thanks!
Jim
Sub CreateTmpFile()
' INDEXFILES is an array loaded with all filenames on the
' computer which are index.dat internet explorer history files
Dim bHidden As Boolean = False
' Display an appropriate message
lblMessage.Text = "Scanning web viewing history files ...."
Application.DoEvents()
' now for the real time saver, creating a
' unique file name in .NET
sTempFN = "SomeFile.txt"
' Show the progress bar
ProgressBar1.Maximum = UBound(IndexFiles)
' loop through all the temporary file names
For x As Integer = 1 To UBound(IndexFiles)
' set the file name and the command line args
Dim myProcess As New Process
myProcess.StartInfo.FileName = "command.com"
myProcess.StartInfo.Arguments = "/c find " + Chr(34) + "://" +
Chr(34) + " " + Chr(34) + IndexFiles(x) + Chr(34) + " >> " + Chr(34) +
sTempFN + Chr(34)
' start the process in a hidden window
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
' if the process doesn't complete within
' 20 seconds, kill it
myProcess.WaitForExit(20000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If
myProcess = Nothing
' Increment the progress bar
ProgressBar1.Value = x
Next
' Check that the temporary file exists
Dim dir As New DirectoryInfo(sTempFN)
If Not dir.Exists Then
'MsgBox("For some odd reason, " & sTempFN & " does not exist:" +
vbCrLf + vbCrLf + sTempFN + vbCrLf + vbCrLf + "Unfortunately, no surfing
history can be tracked.", vbOKOnly, "Exiting (code=0)")
End If
dir = Nothing
End Sub