
15.12.2006, 18:28
|
 |
Местный
|
|
Регистрация: 03.06.2006
Адрес: Почту найдете на моем сайте
Сообщения: 576
Версия Delphi: D10.2
Репутация: 214
|
|
Код:
uses
..., Registry;
procedure Registration( FileType, // Тип файла (расширение)
FileTypeName, // Имя
Description, // Описание
ExecCommand, // Путь к запускному файлу
Index: string ); // Индекс иконки
var
reg: TRegistry;
begin
if ( FileType = '' ) or ( FileTypeName = '' ) or
( ExecCommand = '' ) then Exit;
if FileType[1] <> '.' then FileType := '.' + FileType;
if Description = '' then Description := FileTypeName;
reg := TRegistry.Create;
with Reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey( FileType, true );
WriteString( '', FileTypeName );
CloseKey;
OpenKey( FileTypeName, true );
WriteString( '', Description );
CloseKey;
OpenKey( FileTypeName + '\DefaultIcon', true );
WriteString( '', ExecCommand + ', ' + Index );
CloseKey;
OpenKey( FileTypeName + '\Shell\Open\Command', true );
WriteString( '', ExecCommand + ' %1' );
end;
reg.Free;
end;
procedure TMainFrm.BitBtn1Click(Sender: TObject);
begin
Registration( 'fs', 'fsBase', 'fs Base', Application.ExeName, '0' );
end;
|