1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Function AddCommand(FileType : String;Action : String;Prog : String;DefaultAction : Bool = False) : Bool;
// Ajoute une commande, dans le menu contextuel de l'explorateur, pour un type de fichier donné
Var
RegOp : TRegIniFile;
Begin
RegOp := TRegIniFile.Create('');
Result := True;
Try
Try
RegOp.RootKey := HKEY_CLASSES_ROOT;
If FileType = '' Then Exit;
If DefaultAction Then
RegOp.WriteString(FileType + '\shell', '', Action);
RegOp.WriteString(FileType + '\shell\' + Action + '\command', '', Prog + ' "%1"');
Finally
RegOp.Free;
End;
Except
Result := False;
End;
End;
End. |
Partager