以下是我想对主机是否能网络连接的判断程序,编译通过.
可是调用就是出错,请大虾指点~
{platform:delphi7} function PingHost(hostserver :pChar;hostport:integer):boolean;stdcall;
var retval:boolean;
begin
try
tcpclt.RemotePort:=String(hostport);
tcpclt.RemoteHost:= hostserver ;
tcpclt.Active:= False ;
tcpclt.Open;
retval:= tcpclt.Connected;
finally
tcpclt.Close;
tcpclt.Destroy;
end;
Result:= retval ;
end;若是以上代码存在使用逻辑错误,我该怎么编写?
可是调用就是出错,请大虾指点~
{platform:delphi7} function PingHost(hostserver :pChar;hostport:integer):boolean;stdcall;
var retval:boolean;
begin
try
tcpclt.RemotePort:=String(hostport);
tcpclt.RemoteHost:= hostserver ;
tcpclt.Active:= False ;
tcpclt.Open;
retval:= tcpclt.Connected;
finally
tcpclt.Close;
tcpclt.Destroy;
end;
Result:= retval ;
end;若是以上代码存在使用逻辑错误,我该怎么编写?
Sockets;
type
TcpClient = Class(TTcpClient);var
tcpclt:TCPClient;加上这段,应该更清楚了,我是个新手,多多帮忙啊
try
tcpclt.Active:= False ;
。。将这句提前试试
title:Debugger Exception Notification
message:Project apptest.exe raise exception class EAccessViolation with message '
Access violation at address 00CF3E10 in module 'uskydll.dll'. Read of address
00000048'.
process stopped . usr step or Run to continue.
function IsInternet: Boolean;
begin
if InternetCheckConnection('http://www.163.com/', 1, 0) then
Result := True
else
Result := False;
end; 试试...
2。PingHost是否已在'uskydll.dll'中发布(excepts),调用名称是否正确(注意大小写)