本文整理自网络,侵删。
delphi xe3里判断网络是否连接成功
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Web.Win.Sockets;
type
TForm2 = class(TForm)
TcpServer1: TTcpServer;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
try
TcpServer1.Active :=True ;
ShowMessage('网络已连接')
except
ShowMessage('网络没连接');
end;
end;
end.
相关阅读 >>
Delphi qr /条形码扫描仪应用示例代码(使用zxing,tframestand)
更多相关阅读请进入《Delphi》频道 >>