Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to registering a file type on Windows 9x/2000/NT Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
15-Sep-02
Category
Files Operation
Language
Delphi 2.x
Views
77
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert

Registering a file type on Windows 9x/2000/NT

Answer:

This is typically the task of an installer like Wise or InstallShield, buy you may 
be in a situation where you have to do it manually.

Registering an application to handle a certain file type means putting a few 
entries in the registry. Just use the function from the code below.

1   program RegisterExt;
2   
3   uses
4     Registry;
5   
6   procedure RegisterExtension(
7     const sAppName: string;
8     const sAppPath: string;
9     const sIconName: string;
10    const sExtension: string);
11  var
12    Reg: TRegistry;
13  begin { RegisterExtension }
14    Reg := TRegistry.Create;
15    with Reg do
16    begin
17      RootKey := HKEY_CLASSES_ROOT;
18      OpenKey('.ext', True);
19      WriteString('', sAppName);
20      CloseKey;
21      OpenKey(sAppName, True);
22      WriteString('', sAppName);
23      OpenKey('DefaultIcon', True);
24      WriteString('', sIconName);
25      CloseKey;
26      OpenKey(sAppName + '\shell\open\command', True);
27      WriteString('', sAppPath);
28      CloseKey;
29      Free;
30    end { with Reg };
31  end; { RegisterExtension }
32  
33  begin
34    RegisterExtension('MyGreatApplication',
35      'c:\program files\mystuff\myApp.exe',
36      'c:\program files\mystuff\myApp.ico',
37      '.shl');
38  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC