Solved

Finding Default Web Browser

Posted on 1998-03-20
4
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month6 days, 23 hours left to enroll

622 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