I've created a program that basically links out to installation files so that my university can distribute antivirus program and spyware scanners. One of the links goes out to Windows Updates. It works fine on my computer, but when I burn all of the files to a CD, the code no longer works. Instead, I get this error:
Run-time error '75':
Path/File access error[OK]
How can I get this code to work on a CD? Any help at all would be appreciated.
The Windows Update code that is run when the entry is clicked:
LaunchInNewwindow "http://www.windowsupdate.com"
And here's the rest of the code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public Function LaunchInNewwindow(sURL As String) As Boolean
Const SW_SHOWNORMAL = 1
Dim lRetVal As Long
Dim sTemp As String
Dim sBrowserExec As String
sBrowserExec = GetBrowserExe 'get the exe
sURL = AddHTTP(sURL)
lRetVal = ShellExecute(GetDesktopWindow(), "open", sBrowserExec, sURL, sTemp, SW_SHOWNORMAL)
' lRetVal = ShellExecute(frm.hWnd, "open", sURL, "", sTemp, SW_SHOWNORMAL) '1998/07/31 This works as well
If lRetVal > 32 Then ' OK
LaunchInNewwindow = True
End If
End Function
Private Function AddHTTP(sURL As String) As String
' 2004/12/16 Function added by Larry Rebich using the DELL8500 while in Fort McDowell, AZ
' 2004/12/16 Add http:// is none
Dim sTemp As String
sTemp = sURL
If InStr(LCase$(sTemp), "https://") = 1 Then
AddHTTP = sTemp
ElseIf InStr(LCase$(sTemp), "http://") = 1 Then
AddHTTP = sTemp
Else
AddHTTP = "http://" & sTemp
End If
End Function
Public Function GetBrowserExe() As String
Dim sFilename As String
Dim sBrowserExec As String * 255
Dim lRetVal As Long
Dim iFN As Integer
Dim sTemp As String
sBrowserExec = Space(255)
sFilename = App.Path & "\temphtm.HTM"
iFN = FreeFile() ' Get unused file number
Open sFilename For Output As #iFN ' Create temp HTML file
Print #iFN, "<HTML> <\HTML>" ' Output text
Close #iFN ' Close file
' Then find the application associated with it.
lRetVal = FindExecutable(sFilename, sTemp, sBrowserExec)
' If an application return the name
If lRetVal <= 32 Or IsEmpty(sBrowserExec) Then ' Error
Else
GetBrowserExe = Trim$(sBrowserExec)
End If
Kill sFilename ' delete temp HTML file
End Function