extassociation TacExtAssociation component
Hierarchy Properties Methods Example
Return to Introduction  Previous page  Next page
Overview
The acExtAssociation component lets you to read, install or uninstall the file types (extension associations) to the system registry. Component provides with detalied information about any file types installed to the system (ie. pas, .wav, .doc, .gif, .html). It determinates the executable file, argument string, media-type, icon file, icon index and two icons (32x32 and 16x16) associated with specified file type. To get the information about any file extension — just specify the extension at Extension property.  
 
Also, with acExtAssociation you may install new extensions or modify existing, changing the location of executable file or extension icon. For example, you can install ".yourdatafile" extension, specify the executable program for this file type and point the file icon associated with this file extension in the shell. After opening the any file with ".yourdatafile" extension (clicking the file icon), the application associated with this file type will be executed to process some data from ".yourdatafile".  

How to read the information about the file type ?
Just specify any file extension (ie. pas, .wav, .doc, .gif, .html) to the EXTENSION property. All others properties will be filled with information about extension.  
See also GetExecutableByExtension function of acUtils unit.  

How to install the new file type (file association) ?
1.Switch the component to Read-Write mode (amReadWrite value of AccessMode property)  
2.Assign the file extension to the Extension property.  
3.Specify the type of file in the FileDescription property.  
4.Point the executable file associated with this file type in the ExecutableFile property.  
5.Point the file where stored the extension icon in the IconLocation property. You can point to any icon file — program (.exe), dynamic link library (.dll) or icon (.ico). Value can be same as assigned to the ExecutableFile property.  
6.Specify the icon index optionally in the IconIndex property.  
 
tip Since you don't need to call any method, just done some manipulations with a few properties, you can install the new file extension even at design-time. Please see the code sample for more details.  
 
iiinfo Alternatively you can use InstallExtension method.  

How to uninstall the file extension ?
Just call the UninstallExtension method and specify the extension in Ext parameter of UninstallExtension function.