|
Как определить, что в настоящее время PC подключен
к интернет или нет?
KvORubin© (27.02.02
17:14)
unit Unit1;
interface
uses Windows,
Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
const IC_Modem=1; IC_LAN=
2; IC_PROXY=3; IC_MODEM_BUSY=4; winetdll='wininet.dll';
type TForm1
= class(TForm) Button1: TButton; procedure
Button1Click(Sender: TObject); private { Private
declarations } public { Public declarations
} end;
var Form1:
TForm1;
implementation function
InternetGetConnectedState(lpdwFlags:LPDWORD; dwReserved: DWORD): BOOLEAN;
stdcall; external winetdll name'InternetGetConnectedState';
{$R
*.dfm}
procedure TForm1.Button1Click(Sender: TObject); var
dwConnectionTypes: DWORD; begin
dwConnectionTypes:=IC_MODEM+IC_LAN+IC_PROXY; if
InternetGetConnectedState(@dwConnectionType! s,0) then ShowMessage('Youa
connected') else ShowMessage('No
Connection'); end;
end.
|