Thema: Delphi Icon ändern

Einzelnen Beitrag anzeigen

Benutzerbild von Meflin
Meflin

Registriert seit: 21. Aug 2003
4.856 Beiträge
 
#4

Re: Icon ändern

  Alt 4. Jun 2004, 10:37
Delphi-Quellcode:
function InstallExt(Extension, ExtDescription, FileDescription,
                    OpenWith, ParamString: String; IconIndex: Integer): Boolean;
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    with Reg do
     begin
      RootKey := HKEY_CLASSES_ROOT;
      OpenKey(Extension, True);
      WriteString('', ExtDescription);
      OpenKey('\' + ExtDescription, True);
      WriteString('', FileDescription);
      OpenKey('DefaultIcon', True);
      WriteString('', OpenWith + ','+IntToStr(IconIndex));
      OpenKey('\' + ExtDescription + '\Shell\Open\Command', True);
      WriteString('', '"' + OpenWith + '" "' + ParamString + '"');
     end;
   Result := True;
  except
   Result := False;
  end;
  Reg.Free;
end;

function UnInstallExt(Extension, ExtDescription: String): Boolean;
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    with Reg do
     begin
      RootKey := HKEY_CLASSES_ROOT;
      DeleteKey(Extension);
      DeleteKey('\' + ExtDescription);
     end;
   Result := True;
  except
   Result := False;
  end;
  Reg.Free;
end;
  Mit Zitat antworten Zitat