Solved

File Associations

Posted on 1998-12-04
3
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now