procedure TForm1.FormActivate(Sender: TObject);
Var
ProductName, CompanyName, FileDescription, LegalCopyright, ProductVersion :
String;
i,step : Integer;
begin
PNL_Status.Color :=
RGB(200,100,0);
delay(300);
application.ProcessMessages;
form1.show;
application.BringToFront;
application.ProcessMessages;
application.ShowMainForm:=true;
application.ProcessMessages;
try
application.ProcessMessages;
progressbar.Max := 7;
application.ProcessMessages;
progressbar.StepIt;
PNL_Status.Caption := '
Auslesen von freien Laufwerksbuchstaben';
delay(500);
application.ProcessMessages;
for I := 0
to 25
do
begin
application.ProcessMessages;
if not DriveExists(I)
then
begin
LB_Drives.Items.Add(Chr(I + Ord('
A')) + '
:');
application.ProcessMessages;
end;
end;
application.ProcessMessages;
PNL_Status.Caption := '
Verbinden des Updatelaufwerks';
progressbar.StepIt;
application.ProcessMessages;
loadgrid(Grid_Data,Extractfilepath(paramstr(0))+'
Data.Sux');
for Step := 0
to Grid_Data.rowcount -1
do
begin
if Grid_Data.cells[3,step] = '
UP'
then
begin
edit_UP.text := Grid_Data.Cells[0,step];
end;
end;
(shellexecute(application.handle,
nil,('
net '), PCHAR(('
use ' + LB_Drives.items[1])+ '
' + edit_UP.text),
nil,sw_Normal));
try
application.ProcessMessages;
PNL_Status.Caption := '
Kopieren der neuen EXE';
progressbar.StepIt;
application.ProcessMessages;
windows.copyfile(Pchar(edit_UP.text + '
\AdminTool.exe'),Pchar(Extractfilepath(paramstr(0))+'
Admintool.exe'),false);
PNL_Status.Caption := '
Kopieren der neuen Doku';
progressbar.StepIt;
application.ProcessMessages;
windows.copyfile(Pchar(edit_UP.text + '
\Doku.doc'),Pchar(Extractfilepath(paramstr(0))+'
Doku.doc'),false);
PNL_Status.Caption := ('
Update erfolgreich');
delay(1500);
progressbar.StepIt;
application.ProcessMessages;
PNL_Status.Caption := '
Trennen des Updatelaufwerks';
progressbar.StepIt;
application.ProcessMessages;
wnetcancelconnection(Pchar(LB_Drives.items[1]),false);
delay(500);
application.ProcessMessages;
PNL_Status.Caption := '
Starte AdminTool !';
progressbar.StepIt;
delay(500);
application.ProcessMessages;
GetFileInfo(ProductName, CompanyName, FileDescription, LegalCopyright, ProductVersion, Application.ExeName);
memo1.Lines[0] := (GetCurrentVersion);
memo1.lines.add(FileDescription);
delay(500);
memo1.Lines.SaveToFile(Extractfilepath(paramstr(0))+'
\Updater.ver');
shellexecute(application.handle,'
open',Pchar(Extractfilepath(paramstr(0))+'
\AdminTool.exe'),
nil,
nil,sw_show);
application.terminate;
except
showmessage('
Fehler beim kopieren');
end;
except
application.terminate;
end;
end;