31,23 → 31,27 |
|
{$R *.dfm} |
|
// http://www.delphipraxis.net/post43515.html |
Function GetHTML(AUrl: string): string; |
const |
ProgrammVersion = '1.5'; |
|
// https://www.delphipraxis.net/post43515.html , fixed , works for Delphi 12 Athens |
function GetHTML(AUrl: string): RawByteString; |
var |
databuffer : array[0..4095] of char; |
ResStr : string; |
databuffer : array[0..4095] of ansichar; // SIC! ansichar! |
ResStr : ansistring; // SIC! ansistring |
hSession, hfile: hInternet; |
dwindex,dwcodelen,dwread,dwNumber: cardinal; |
dwcode : array[1..20] of char; |
res : pchar; |
Str : pchar; |
Str : pansichar; // SIC! pansichar |
begin |
ResStr:=''; |
if pos('http://',lowercase(AUrl))=0 then |
if (system.pos('http://',lowercase(AUrl))=0) and |
(system.pos('https://',lowercase(AUrl))=0) then |
AUrl:='http://'+AUrl; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then Application.ProcessMessages; |
|
hSession:=InternetOpen('InetURL:/1.0', |
INTERNET_OPEN_TYPE_PRECONFIG, |
57,7 → 61,7 |
if assigned(hsession) then |
begin |
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
hfile:=InternetOpenUrl( |
hsession, |
70,7 → 74,7 |
dwCodeLen := 10; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
HttpQueryInfo(hfile, |
HTTP_QUERY_STATUS_CODE, |
88,23 → 92,23 |
begin |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
if dwRead =0 then |
break; |
databuffer[dwread]:=#0; |
Str := pchar(@databuffer); |
Str := pansichar(@databuffer); |
resStr := resStr + Str; |
end; |
end |
else |
ResStr := 'Status:'+res; |
ResStr := 'Status:'+AnsiString(res); |
if assigned(hfile) then |
InternetCloseHandle(hfile); |
end; |
|
// Hinzugefügt |
application.ProcessMessages; |
if Assigned(Application) then application.ProcessMessages; |
|
InternetCloseHandle(hsession); |
Result := resStr; |
112,7 → 116,7 |
|
procedure TInfoForm.Button1Click(Sender: TObject); |
var |
temp: string; |
temp: RawByteString; |
begin |
temp := GetHTML('http://www.viathinksoft.de/update/?id=musikbox'); |
if copy(temp, 0, 7) = 'Status:' then |
121,7 → 125,7 |
end |
else |
begin |
if GetHTML('http://www.viathinksoft.de/update/?id=musikbox') <> '1.5' then |
if GetHTML('http://www.viathinksoft.de/update/?id=musikbox') <> ProgrammVersion then |
begin |
if Application.MessageBox('Eine neue Programmversion ist vorhanden. Möchten Sie diese jetzt herunterladen?', 'Information', MB_YESNO + MB_ICONASTERISK) = ID_YES then |
shellexecute(application.handle, 'open', pchar('http://www.viathinksoft.de/update/?id=@musikbox'), '', '', sw_normal); |