uses ExtCtrls, IniFiles, UrlMon, Gauges, ComCtrls
private
{ Private declarations }
winsc: TiniFile;
old: Integer;
vernfo: TIniFile;
//
function DownloadFile(Source, Dest: string): Boolean;
{ Function for Downloading the file found on the net }
begin
try
Result := UrlDownloadToFile(nil, PChar(Source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
function GetPathPath: string;
{ Retrive app path }
begin
Result := ExtractFilePath(Application.ExeName);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//App version
winsc := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
try
old := winsc.ReadInteger('wsc', 'vernfo', 1);
finally
winsc.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
apath: string;
new: Integer;
begin
// This is the exact code from my application
apath := GetPathPath;
Form1.Gauge1.Progress := 0;
Form1.StatusBar1.SimplePanel := True;
Form1.StatusBar1.SimpleText := 'Connecting to https://www.website.de';
Form1.Gauge1.Progress := 20;
if DownloadFile('https://www.website.de/update.ini', PChar(apath) + '/update.ini') then
begin
Form1.Gauge1.Progress := 50;
Form1.StatusBAr1.SimplePanel := True;
Form1.StatusBar1.SimpleText := 'Checking for newer versions...';
Form1.vernfo := TiniFile.Create(GetPathPath + '/update.ini');
new := Form1.vernfo.ReadInteger('version', 'wsc', 7);
Form1.vernfo.Free;
if (Form1.old = new) then
begin
Form1.StatusBar1.SimplePanel := True;
Form1.StatusBar1.SimpleText := 'No new version detected';
Form1.Gauge1.Progress := 100;
end
else if DownloadFile('https://www.website.de/myExe.exe',
PChar(apath) + '/myExe.exe') then
begin
ShowMessage('Update succeseful');
Form1.Gauge1.Progress := 100;
Form1.winsc := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
Form1.winsc.WriteInteger('wsc', 'vernfo', new);
Form1.winsc.Free;
end
else
MessageDlg('A new version has appeard but it requires a second install',
mtInformation, [mbOK], 0);
end
else
begin
Form1.StatusBar1.SimplePanel := True;
Form1.StatusBar1.SimpleText := 'Failed to connect probably a internet problem';
Form1.Gauge1.Progress := 0;
end;
end;

Update Program via Internet
Abonnieren
Posts (Atom)
Beliebte Posts
-
Windows Key Sniffer 0.82 - Update 08/2024 Der Windows Key Sniffer hat mir im Laufe der Zeit viel Arbeit erspart und unterstützt, viele Wi...
-
Network Source Code Update Source Code Network Update : https://asciigen.blogspot.com/p/network.html Send Message 1.0 Source Server Client ...
-
Windows Defender Bypass Version 0.75 - Update 11/2024 Den Windows 10-eigenen Virenschutz Defender kann man auf mehreren Wegen abschalt...
-
ASCii GIF Animator Update Version 0.68 (32 bit) - 11/2024 Bei dieser überarbeiteten Version ist die Kompatibilität zu den verschiedenen...
-
MD5 Hacker v.0.26 - Update 08.2024 MD5 Hashs sollten eigentlich nicht entschlüsselt werden können. Jedoch gibt es Tools, mit welchen auch ...
-
Host Editor Version 0.65 - Update 01/2025 Hosts File Editor allows for the easy editing of host files and backup creation. Create your ...
-
Dir Sniffer Version 0.11 - Update 02/2025 Dir Sniffer ist ein kleines aber nützliches Tool um herauszufinden, was ihr Programm auf ihrem...
-
Oldskool Font Generator v.0.29 - Update 11/2023 Das Tool stell 508 Bitmap Fonts zu Verfügung. Eigene Fonts können integriert werden, sie...
-
Hard Crypter 0.19 - Update 12/2023 Mit diesem Tool können Sie jede beliebige Datei auf dem Windows-System verschlüsseln. Die Byte-Erse...
Keine Kommentare:
Kommentar veröffentlichen