Einzelnen Beitrag anzeigen

Benutzerbild von CoRe.eXtreem
CoRe.eXtreem

Registriert seit: 30. Nov 2003
61 Beiträge
 
Delphi 2005 Personal
 
#1

Programm Updaten

  Alt 30. Nov 2003, 20:32
Hallo,
ich versuche gerade ein Live-Update in mein Programm ein zu bauen. So weit so gut! Aber wie ersetze ich das Laufende Programm mit einer Heruntergeladenen Datei??

Hier ist der Quellcode;

Delphi-Quellcode:
procedure TForm1.Update2Click(Sender: TObject);
var
  old, new : string;
begin
if DownloadFile('http://www.ensacom.de/Delphiprogramme/Delphimanager/update.ini',(Extractfilepath(Application.exename)+'Update\update.000')) then
begin
  DownloadFile('http://www.ensacom.de/Delphiprogramme/Delphimanager/update.upd',(Extractfilepath(Application.exename)+'Update\update.upd'));
end;
 iniold := tinifile.Create(Extractfilepath(Application.exename)+'Update\update.ini');
  try
  old := iniold.ReadString('Version','Datum','');
  finally
  iniold.Free;
  end;

  ininew := tinifile.Create(Extractfilepath(Application.exename)+'Update\update.000');
  try
  new := ininew.ReadString('Version','Datum','');
  finally
  ininew.Free;
  end;

  if old < new then begin
  if MessageDlg('Es ist ein neues Update verfügbar. Jetzt installieren?',
     mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
     deletefile(Extractfilepath(Application.exename)+'Update\update.ini');
     renamefile(Extractfilepath(Application.exename)+'Update\update.000',(Extractfilepath(Application.exename)+'Update\update.ini'));

    UpdateInstallieren(self); <-- das Funktionier nicht???
  end;
  end
  else
  begin
     showmessage('Kein neues Update verfügbar!');
     deletefile(Extractfilepath(Application.exename)+'Update\update.000');
     deletefile(Extractfilepath(Application.exename)+'Update\update.upd');
  end;
end;
Wäre sehr nett wenn mir hier jemand weiter helfen könnte!

[edit=Christian Seehase]Delphi-Tags gesetzt. Bitte künftig selber machen. Danke. Mfg, Christian Seehase[/edit]
  Mit Zitat antworten Zitat