Solved

File Associations

Posted on 1998-12-04
3
159 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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