摘要载入中… 请稍等…
内容载入中… 请稍等…
| ◎→ | 本类最新 |
|
远程程序运行状态的简单监控 在IE上增添一个按钮 在Delphi中实现ASP编程 在Delphi程序中应用IE浏览器控件 在DELPHI程序中拨号上网 用Delphi编写ASP的ActiveX服务器 用Delphi编写CGI程序返回图象 |
|
| ◎→相关资源 | |
| C语言入门视频教程 C#编程WinForm入门视频 Asp.net入门视频教程下载 VC++编程视频教程下载 VB窗体文章 HTML入门教程 Deiphi实例教程 Deiphi窗体文章 Deiphi数据库编程 Deiphi网络编程 Deiphi图形图象文章 Deiphi系统文件 | |
| ◎→ | 热门资源 |
| 为什么创建VCL for .NET? -- De 为什么创建VCL for .NET? -- De 搜索字符串在流中的位置 在Delphi7中实现停靠功能 在DELPHI中如何调用系统对话框 用Delphi来编写蠕虫病毒浅析 用Delphi编程实现清空回收站功能 |
|
其相应代码如下:
变量说明
var
CommForm: TCommForm;
ss :string;
savef,readf :file of char;
i,j :longint;
初始化
procedure TCommForm.FormCreate(Sender: TObject);
begin
mscomm.commport:=1;
mscomm.settings:='9600,n,8,1';
mscomm.inputlen:=1;
mscomm.inbuffercount:=0;
mscomm.portopen:=true;
ss:='';
i:=0;
j:=0;
assignfile(savef,'save1');
rewrite(savef);
assignfile(readf,'read1');
reset(readf);
end;
设置确定
procedure TCommForm.btnConfirmClick(Sender: TObject);
begin
if mscomm.portopen then
mscomm.portopen:=false;
mscomm.commport:=strtoint(edtCommport.text);
mscomm.settings:=edtCommsetting.Text;
end;
传输事件
procedure TCommForm.MSCommComm(Sender: TObject);
var
filenrc :char;
buffer :variant;
s1:string;
c :char;
begin
case mscomm.commEvent of
comEvSend:
begin
while not(eof(readf)) do
begin
read(readf,filenrc);
mscomm.output:=filenrc;
j:=j+1;
lblDisplay.caption:=inttostr(j);
if mscomm.outbuffercount>=2 then
break;
end;
end;
comEvReceive:
begin
buffer:=mscomm.Input;
s1:=buffer;
c:=s1[1];
ss:=ss+c;
i:=i+1;
lblDisplay.caption:=c+inttostr(i);
write(savef,c);
if (c=chr(10))or(c=chr(13)) then
begin
lblDisplay.caption:='cr'+inttostr(i);
memDisplay.lines.add(ss);
ss:='';
end;
end;
end;
end;
| 芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们 |