fileassociation InstallFileType method
Example
Return to Introduction  Previous page  Next page
Applies to
dcFileAssociation component.  

Declaration
function TdcFileAssociation.InstallFileType(Extension, ExecutableFile, ParamString, MIMEType, ExtDescription, FileDescription, IconFile: String; IconIndex: Integer): Boolean;  

Description
The InstallFileType method is the alternative way to install the new file type to the Windows shell.  
 
ParametersMeaning  
Extensionspecifies the file extension. For example, '.test';  
ExecutableFilespecifies the executable file associated with this file type (see ExecutableFile property);  
ParamStringspecifies the command-line parameters to transmit to the executable file on startup (see ParamString property);  
MIMETypespecifies the media-type of the extension (see MIMEType property). This parameter can be empty;  
ExtDescriptionunique identifier for file extension, used internally within Windows shell (see ExtDescription property);  
FileDescriptiondescription of file type (will be visible in Windows explorer and "Properties" dialog) (see FileDescription property);  
IconFilelocation of the icon file (can be an EXE, DLL or ICO) (see IconLocation property);  
IconIndexindex of the icon in the IconFile (see IconIndex property).  
 
tip To uninstall the extension from the shell - use UninstallFileType method.  

Example
procedure TForm1.InstallButtonClick(Sender: TObject);  
begin  
  dcFileAssociation1.InstallFileType('.avi',   
  'C:\Program Files\Windows Media Player\MPLAYER2.EXE''%1''',  
  'avifile''AVI Clip'''0);  
end;  

See also
UninstallFileType method;  
ExecutableFile, ParamString, MIMEType, ExtDescription, FileDescription, IconLocation and IconIndex properties.