1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| function TForm1.Connected2: Boolean;
var
bconnect: boolean;
httphandle: HINTERNET;
openhandle: HINTERNET;
connectionhandle: HINTERNET;
begin
bconnect:=false;
openhandle := InternetOpen('PRM8', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if Assigned(openhandle) then
begin
try
connectionhandle:=InternetConnect(openhandle,PChar('http://rapporteur.meteo.free.fr'),INTERNET_DEFAULT_HTTP_PORT,nil,nil,INTERNET_SERVICE_HTTP,0,1);
if Assigned(connectionhandle) then
begin
try
httphandle:=HttpOpenRequest(connectionhandle,nil,PChar('/PRM.html'),nil,nil,nil, INTERNET_FLAG_RELOAD, 1);
if Assigned(httphandle) then
begin
bconnect:=true;
InternetCloseHandle(httphandle);
end;
finally
InternetCloseHandle(connectionhandle);
end;
end;
finally
InternetCloseHandle(openhandle);
end;
end;
Result := bconnect
end; |
Partager