用系统的url.dll(这个dll,系统一般都有ie5,office都包含这个dll)function InetIsOffline(Flag: Integer): Boolean; stdcall; external 'URL.DLL';调用代码:
procedure TFrmInternetDemo.Button1Click(Sender: TObject);
begin
if InetIsOffline(0) then
ShowMessage('This computer is not connected to Internet!')
else
ShowMessage('You are connected to Internet!');
end;
procedure TFrmInternetDemo.Button1Click(Sender: TObject);
begin
if InetIsOffline(0) then
ShowMessage('This computer is not connected to Internet!')
else
ShowMessage('You are connected to Internet!');
end;
解决方案 »
- 自动增加的问题,谢谢,急
- 比如说,很多edit要清空,能否把他们弄成一个数组??
- 如何把一串带很多逗号的字符串分割?
- 求救!!!!!!!!!!!!!!!
- 在线等,散分啦!SQL数据库能不能存JPG格式图片?如何做啊??
- win2000或XP环境下的打印走纸问题
- 程序无法调试??!! 急◎#¥%※
- 一个关于TWinSocketStream的问题
- 高手都不一定能解决的问题!!!
- 各位:请问有用WinMe的吗,太不好用了,打开网上邻居查找一次后便出停止了,漫长的待待。实在让人难以接受。
- 如何读限局域网内其它机子windows所在的目录?
- 用ADOQUERYR通过一个SELECT的SQL语句取得结果集后,如何在程序中判断结果集中的数据以被用户所改动?
这一句
function InetIsOffline(Flag: Integer): Boolean; stdcall; external 'URL.DLL';
在C++BUILDER中怎么定义?特别是涉及external 'URL.DLL';
uses WinInet;function IsOnline:Boolean;
var
ConnectState,StateSize:DWORD;
begin
Result:=False;
if not InternetCheckConnection('http://www.microsoft.com/',1,0) then
Exit;
ConnectState:=0;
StateSize:=SizeOf(ConnectState);
if InternetQueryOption(nil,INTERNET_OPTION_CONNECTED_STATE,@ConnectState,StateSize) then
if (ConnectState and INTERNET_STATE_DISCONNECTED)<>2 then
Result:=True;
end;