Shortcut to default browser

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dburrill
    Forum Member
    • Jul 2000
    • 3

    Shortcut to default browser

    HELP!

    How do I install an icon onto the desktop that points to the user's default browser?

    This will probably require querying the Registry.

    Thanks for any help.

  • John Schacher
    Forum Member
    • May 2000
    • 19

    #2
    Re: Shortcut to default browser

    You're right about requiring a lookup in the registry. You'd want to refer to the .htm file association which is a two part registry query.

    First, query for the default value of .htm file extension in HKEY_CLASSES_ROOT.
    Ex:
    HKEY_CLASSES_ROOT\.htm
    (Default)="htmlfile"

    Next, take this default value as the key to look for in HKEY_CLASSES_ROOT. This is where windows store all the intesting information. In your case, you'd want to look for the default value of the Open Command subkey.
    Ex:
    HKEY_CLASSES_ROOT\htmlfile\shell\open\command
    (Default)="\"E:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome"

    Take this value and set a shortcut to the same string.

    A word of caution: When using this technique, once your application has installed, if the user installs a different browser, your shortcut may no longer be valid because the .htm file association may point to a different browser. This risk may be acceptable in your situation.

    An alternative technique: You could install a placeholder .htm file on the users local system (it could point to somewhere interesting or simply be empty). Set a shortcut to this placeholder file. As you know, clicking the shortcut would simply launch the local .htm file and let Windows do the registry lookup at runtime. This would always invoke the default browser, even if the user installed a different one after your application installed.

    Hope this helps,
    -John

    Comment

    • dburrill
      Forum Member
      • Jul 2000
      • 3

      #3
      Re: Shortcut to default browser

      Thanks very much for your help.

      Most appreciated.

      Best Regards,

      Duncan

      Comment

      Working...
      X