opening all types of files

I have a VB6 question:

In code, how do I open for example, an html file in Internet Explorer from my program. Or, a text file in Notepad. Or a bitmap in Photoshop. You get the idea.

Is there any way to open a file on a user's computer, using their default program for that file type?
vitanzaAsked:
Who is Participating?
 
bobbit31Connect With a Mentor Commented:
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 Const SW_SHOWNORMAL = 1


Private Sub Command1_Click()
    ShellExecute 0, "open", "C:\Documents and Settings\bob\My Documents\FlightInfo.doc", vbNullString, vbNullString, SW_SHOWNORMAL

End Sub
0
 
bobbit31Commented:
just replace C:\Documents and Settings\bob\My Documents\FlightInfo.doc with the path to whatever file you want to open (sorry, i forgot to change it before posting) ;)
0
 
vitanzaAuthor Commented:
Thanks, that's exactly what I wanted!
Also, do know any sites where I can get more info on shell commands?
0
All Courses

From novice to tech pro — start learning today.