Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Finding Default Web Browser

Posted on 1998-03-20
4
Medium Priority
?
194 Views
Last Modified: 2011-09-20
Does anyone know how I can find the default web browser from within a Delphi 2 application ?
The obvious way was to look in the registry for the shell open command for a HTML file, but it doesnt exist in mine :(  so I can't rely on this method.  If I double click an HTML file from explorer though it does launch netscape so the information is stored somewhere.

Daz
0
Comment
Question by:Dazza051197
  • 2
4 Comments
 
LVL 4

Expert Comment

by:itamar
ID: 1360657
Hi Dazz,

If you want to find out the default WEB browser just to open a URL or a specif HTML file, actually you don't need to. Just use the shell procedure to do it, and the result wil be the same as double-clicking in the Explorer.

But if you need to know it for others reasons you can find it in the registry at:

HKEY_CLASSES_ROOT\HtmlDefBrowser\shell\open\command

IHTH,

Itamar
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1360658
That key doesnt exist in my registry and neither in my mates registry, so I can't rely on that either.  How does Netscape and/or Internet Explorer know they are not the default browsers ?
0
 
LVL 7

Accepted Solution

by:
ahalya earned 100 total points
ID: 1360659
Here goes a function that will return the associated EXE file for a given extension:

call GetAssociation('.html') to get the path to NS.

====
function GetAssociation(Ext:String):string;

var R      : TRegistry;
    s      : string ;


begin
s := '';
if pos('.', Ext) <> 1 then Ext := '.' + Ext;
R := TRegistry.Create;
try
R.Rootkey := HKey_CLASSES_ROOT;
if R.OpenKey(Ext, false) then
   s := R.ReadString('');
R.Closekey;
s := s + '\CLSID';
if R.OpenKey(s, false) then
   s := R.ReadString('');
R.Closekey;
S := 'CLSID\' + s + '\LocalServer32';
if R.OpenKey(s, false) then
   s := R.ReadString('');
R.Closekey;

finally
   R.Free;
   end;
GetAssociation := s;
end;

0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1360660
Worked on one computer but another one gave lnprocserver32 ???  I used your idea for something else though so I've still given you the points.

Darren
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question