I'd like to open a html file with the system's default browser from my application. How do I detect if there's a browser installed? And how can I open that browser with specified file?
Printable View
I'd like to open a html file with the system's default browser from my application. How do I detect if there's a browser installed? And how can I open that browser with specified file?
Use the ShellExecute command to open a registered file type
with its associated program. If IE is associated with .htm files the command below will open the file test.htm in IE.
If Netscape is associated with .htm, then Netscape will start up.
This will also work for other registered file types likeCode:Call ShellExecute(hwnd, "Open", "c:\temp\test.htm", "", App.Path, 1)
.doc, .txt, etc. They would open with their associated
apps like Word, Notepad, etc.
Hope this helps.
Gl,Code:'the API was forgoten in the last post
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
D!m
Thanks. It works!