by PalotasB (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 14th April 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Open file/website to default editor/browser
"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 Sub Form_Load()
' If the file doesn't exist no error occures
' Just change Filepath to another file on your HD or
' to a website to shell default browser. Example:
'
' FilePath="http://www.microsoft.com"
FilePath = "c:\Example.txt"
OpenFileDefault hwnd, "open", FilePath, vbNullString, _
vbNullString, 1
End Sub