Results 1 to 4 of 4

Thread: how to open default browser?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    Australia
    Posts
    115
    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?

  2. #2
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    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.

    Code:
    Call ShellExecute(hwnd, "Open", "c:\temp\test.htm", "", App.Path, 1)
    This will also work for other registered file types like
    .doc, .txt, etc. They would open with their associated
    apps like Word, Notepad, etc.

    Hope this helps.
    JC

  3. #3
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    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
    Gl,
    D!m
    Dim

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    Australia
    Posts
    115
    Thanks. It works!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width