Solved

Finding Default Web Browser

Posted on 1998-03-20
4
184 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now