//检查连网状态 function TForm1.InternetConnected: boolean; const // local system uses a modem to connect to the internet. // internet_connection_modem = 1; // local system uses a local area network to connect to the internet. internet_connection_lan = 2; // local system uses a proxy server to connect to the internet. // internet_connection_proxy = 4; // local system''s modem is busy with a non-internet connection. // internet_connection_modem_busy = 8; var dwconnectiontypes : dword; begin dwconnectiontypes := nternet_connection_lan; result := internetgetconnectedstate(@dwconnectiontypes, 0); end;
DWORD 是32位的一个整型值,楼上的代码需要uses Wininet//检查连网状态 function TForm1.InternetConnected: boolean; const // local system uses a modem to connect to the internet. // internet_connection_modem = 1; // local system uses a local area network to connect to the internet. internet_connection_lan = 2; // local system uses a proxy server to connect to the internet. // internet_connection_proxy = 4; // local system''s modem is busy with a non-internet connection. // internet_connection_modem_busy = 8; var dwconnectiontypes : dword; begin dwconnectiontypes := internet_connection_lan; result := internetgetconnectedstate(@dwconnectiontypes, 0); end;
function TE_databasef.InternetConnected: boolean; var dwconnectiontypes : integer; begin dwconnectiontypes:=INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY; if InternetGetConnectedState(@dwconnectiontypes, 0) then Result := False else Result := True; end; 在该窗体创建时进行判断 if not InternetConnected then showmessage('无网络状态') else begin end; 可不知道为什么第一次把网线拨掉时会运行正常,提示无网络状态,可将网线插上后还一直提示'无网络状态~!!
放到一个timer中,每隔几秒检测一下网络状态procedure TForm1.Timer1Timer(Sender: TObject); begin if InternetConnected then Caption := '网络正常' else Caption := '无网络'; end;
function TForm1.InternetConnected: boolean;
const
// local system uses a modem to connect to the internet.
// internet_connection_modem = 1;
// local system uses a local area network to connect to the internet.
internet_connection_lan = 2;
// local system uses a proxy server to connect to the internet.
// internet_connection_proxy = 4;
// local system''s modem is busy with a non-internet connection.
// internet_connection_modem_busy = 8;
var
dwconnectiontypes : dword;
begin
dwconnectiontypes := nternet_connection_lan;
result := internetgetconnectedstate(@dwconnectiontypes, 0);
end;
nternet_connection_lan 这个又表示什么意思??
不好意思哦~~~我是新手~加菜鸟~!
function TForm1.InternetConnected: boolean;
const
// local system uses a modem to connect to the internet.
// internet_connection_modem = 1;
// local system uses a local area network to connect to the internet.
internet_connection_lan = 2;
// local system uses a proxy server to connect to the internet.
// internet_connection_proxy = 4;
// local system''s modem is busy with a non-internet connection.
// internet_connection_modem_busy = 8;
var
dwconnectiontypes : dword;
begin
dwconnectiontypes := internet_connection_lan;
result := internetgetconnectedstate(@dwconnectiontypes, 0);
end;
var
dwconnectiontypes : integer;
begin
dwconnectiontypes:=INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
if InternetGetConnectedState(@dwconnectiontypes, 0) then
Result := False
else
Result := True;
end;
在该窗体创建时进行判断 if not InternetConnected then
showmessage('无网络状态')
else
begin
end;
可不知道为什么第一次把网线拨掉时会运行正常,提示无网络状态,可将网线插上后还一直提示'无网络状态~!!
begin
if InternetConnected then
Caption := '网络正常'
else
Caption := '无网络';
end;
ping 下交换机。。 或者其他 ip
dwconnectiontypes:=INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
它的值起先为17,(没有插网线)
我插网线后一直为18,结果是为假的啊.
试试 postren(小虫) 的方法看~
还有问下有哪位有用过sqldmo_tlb这个文件???????
要修改application类,可不懂在哪里修改,现在程序中一直不能用application.方法,与DELPHI自定义的application类有冲突!