请教一个网址检查问题!(30分)

K

kawais

Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个小程序,想一次检查很多网址是否存在.
但检查中,如果有一个网址不存在,如http://www.7456.com,
就会提示"null remote address",在delphi中运行时,
显示一个"host lookup failed"错误.
我想在出现这么问题时,跳过这些网址,继续下面的检查.
该如何解决?
望大家指点!thanks!
 
把代碼貼出來不是可以更好的讓大家為你解決問題﹗
 
程序中有一个stringgrid,第一列用于导入一个文本文件中的网址,
第二列显示replynumber,但一当有个网址不存在,程序就会中止.
var
temp:string;
i,j:integer;
begin
i:=1;
j:=1;
for i:=1 to sg.RowCount-1 do
begin
temp:=string(sg.cells[0,i]);
nmhttp1.InputFileMode:=FALSE;
nmhttp1.OutputFileMode:=FALSE;
nmhttp1.ReportLevel:=Status_Basic;
nmhttp1.head(temp);
sg.Cells[1,j]:=inttostr(nmhttp1.ReplyNumber);
j:=j+1;
end;
nmhttp1.Abort;
end;
望大家指点thanks
 
也许你可以用这个函数(注意在 uses 中要加上 WinInet):
if InternetCheckConnection('http://www.7456.com',1,0) then
showmessage('存在')
else
showmessage('不存在');


 
试过那个函数了,不管用...
 
用try吧,出现异常再判断好了,要不做起来很麻烦。
 
菜鸟问题:那我该用什么办法来判断出现了异常呢?
[:(]
 
顶部