Author : PalotasB
Date Submitted : 4/14/2006
Category : File Manipulation
Compatibility : VB 6
This code has been accessed 4068 times.
Task : Open file/website to default editor/browser
Declarations
Code
Private Declare Function OpenFileDefault 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 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