delphi7中,自定义函数在程序中什么编写
答案:2 悬赏:0
解决时间 2021-03-03 09:10
- 提问者网友:神仙爷爷
- 2021-03-02 11:25
delphi7中,自定义函数在程序中什么编写
最佳答案
- 二级知识专家网友:魅世女王
- 2021-03-02 12:51
给你个列子
声明一个函数
//ping网络
function fucPing(url: String): Boolean;
函数实现
//ping网络
function fucPing(url: String): Boolean;
var
aIdICMPClient: TIdICMPClient;
begin
aIdICMPClient:= TIdICMPClient.Create(nil);
aIdIcmpclient.ReceiveTimeout:=500;
aIdICMPClient.Host:= url;
try
aIdICMPClient.Ping();
except
Result:= false;
end;
if (aidicmpclient.ReplyStatus.fromipaddress<>'0.0.0.0')
and (aidicmpclient.ReplyStatus.fromipaddress<>'') then
result:= true
else
result:= false;
aIdICMPClient.Free;
end;
声明一个函数
//ping网络
function fucPing(url: String): Boolean;
函数实现
//ping网络
function fucPing(url: String): Boolean;
var
aIdICMPClient: TIdICMPClient;
begin
aIdICMPClient:= TIdICMPClient.Create(nil);
aIdIcmpclient.ReceiveTimeout:=500;
aIdICMPClient.Host:= url;
try
aIdICMPClient.Ping();
except
Result:= false;
end;
if (aidicmpclient.ReplyStatus.fromipaddress<>'0.0.0.0')
and (aidicmpclient.ReplyStatus.fromipaddress<>'') then
result:= true
else
result:= false;
aIdICMPClient.Free;
end;
全部回答
- 1楼网友:ー何必说爱
- 2021-03-02 14:26
1.你自己的文件,文件的命名完全由你自己决定。
2.打开、创建文件的方式很多种,
例如使用操作系统级别的函数中的 createfile、readfile、writefile等
例如使用 delphi 提供的文件操作函数 assignfile、readln、writeln等
例如使用流来控制,如tfilestream等
3.具体采用哪种方式通常根据你使用的文件的特点或你熟悉的程度来选择
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯