Solved

File Associations

Posted on 1998-12-04
3
163 Views
Last Modified: 2010-04-04
How do I check the Win32-Registry for the Association of specified File Types, to see if they are assigned to my Program ?
0
Comment
Question by:omsec
[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
3 Comments
 
LVL 1

Accepted Solution

by:
sassas081597 earned 20 total points
ID: 1349273
Here is an example of looking for assosiation.
  Uses Registry;

  With TRegistry.Create Do
  Begin
    RootKey := HKEY_Classes_Root;
    OpenKeyReadOnly('.XXX');
    ExtName := ReadString('');
    CloseKey;

    ExtName := ExtName + '\shell\open\command';
    OpenKeyReadOnly(ExtName);
    AppPath := ReadString('');
    CloseKey;

    ShowMessage(AppPath);
  End;
The AppPath is what you are looking for.
0
 
LVL 2

Author Comment

by:omsec
ID: 1349274
could you please also post a short code, to write a new association to the registry ?

XXX   = My Program File (Description of the Type)
0
 
LVL 1

Expert Comment

by:sassas081597
ID: 1349275
Here you are
const AppPath : 'C:\MyPath\...'
with TRegistry.Create do
   try
     RootKey := HKEY_Classes_Root;
     OpenKeyReadOnly('.XXX');
     ExtName := ReadString('');
     CloseKey;

     ExtName := ExtName + '\shell\open\command';
     OpenKey(ExtName,True);
     WriteString('Default', AppPath);
     CloseKey;
   finally
      Free;
   end;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 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