Solved

Finding Default Web Browser

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

16 Experts available now in Live!

Get 1:1 Help Now