delphi 판단 네트워크 연결

596 단어 Delphi
uses WinInet;



procedure TForm1.Button1Click(Sender: TObject);

begin

  if InternetGetConnectedState(nil, 0) then ShowMessage('   ');

end;



function NetWorkIsConnect: Boolean; 

var 

  ConTypes : Integer; 

begin 

  Result := false; 

  ConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY; 

if InternetGetConnectedState(@ConTypes, 0) then //ConTypes := $01 + $02 + $04; 

  Result := True 

else 

if InternetCheckConnection('http://www.microsoft.com/', 1, 0) then 

  Result := True; 

end;


 

좋은 웹페이지 즐겨찾기