extassociation InstallExtension method
Example
Return to Introduction  Previous page  Next page
Applies to
acExtAssociation component.  

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

Description
The InstallExtension 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 UninstallExtension method.  

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

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