TdcFileAssociation component
Properties Methods Example |
The dcFileAssociation 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, 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 dcFileAssociation 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".
|
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.
|
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.
|
|
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.
|
|
Alternatively you can use InstallFileType method.
|
Just call the UninstallFileType method and specify the extension in Ext parameter of UninstallFileType function.
|
|