unit Unit1;
interface
uses
Windows, Messages, SysUtils, wininet,Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Types : Integer;
begin
Types := INTERNET_CONNECTION_MODEM +
INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
//check 3 conditions together
if InternetGetConnectedState(@types, 0) then
Edit1.Text := 'your pc is Online now'
else
Edit1.Text := 'your pc is offline now';
end;
end.
检测网络状态的Delphi程序
本文介绍了一个使用Delphi编写的简单程序,该程序能够检测计算机当前的网络连接状态,包括是否通过调制解调器、局域网或代理服务器连接到互联网,并将结果输出到界面上。
4177

被折叠的 条评论
为什么被折叠?



