1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52:
| var Form1: TForm1; E1,E2,E3: string; reg: TRegistry; typ: string;
implementation
uses Info2;
{$R *.dfm} procedure AddFileMenue(FilePrefix, Menue, Command: string); begin reg := TRegistry.Create; with reg do begin RootKey := HKEY_CLASSES_ROOT; OpenKey('.' + FilePrefix, True); typ := ReadString(''); if typ = '' then begin typ := Fileprefix + 'file'; WriteString('', typ); if reg.KeyExists('typ') = TRUE then ShowMessage ('OK') end; CloseKey; OpenKey(typ + '\shell\' + Menue + '\command', True);
WriteString('', command + ' "%1"'); CloseKey; Free; end; end;
procedure DeleteFileMenue(Fileprefix, Menue: string); begin reg := TRegistry.Create; with reg do begin RootKey := HKEY_CLASSES_ROOT; OpenKey('.' + Fileprefix, True); typ := ReadString(''); CloseKey; OpenKey(typ + '\shell', True); DeleteKey(Menue); CloseKey; Free; end; end; procedure TForm1.Button1Click(Sender: TObject); begin AddFileMenue (E3.Text E2.Text , E1.Text); |