Solved

Finding Default Web Browser

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 143
Using idhttp to login to instagram 2 89
Can Viruses spread while transferring Binary data with Winsock 2 76
Delphi...Split view - idea? 1 68
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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