Mscomm问题,为什么我的mscomm的oncomm事件的接收中只有八个字符?我mscomm1.RThreshold:=1;其余的另外在触发oncom事件?

xinqingbucuo 2005-03-28 07:48:53
Mscomm问题,为什么我的mscomm的oncomm事件的接收中只有八个字符?我mscomm1.RThreshold:=1;其余的另外在触发oncom事件?
...全文
282 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xinqingbucuo 2005-04-22
  • 打赏
  • 举报
回复
问题没有解决,换了个控件,感谢个位的帮忙,结贴了
admas 2005-04-20
  • 打赏
  • 举报
回复
或者设为更大的
admas 2005-04-20
  • 打赏
  • 举报
回复
mscomm1.RThreshold:=1设为12就可以,不过会引发其他问题,研究中!!!
XuDunYu 2005-04-14
  • 打赏
  • 举报
回复
另外InputMode 设为comInputModeBinary
XuDunYu 2005-04-14
  • 打赏
  • 举报
回复
接收之前需要设inputlen=0
xinqingbucuo 2005-04-14
  • 打赏
  • 举报
回复
怎么还没有人回答,我还是相弄懂是什么问题
xinqingbucuo 2005-04-04
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, MSCommLib_TLB;

type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
MSComm1: TMSComm;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure MSComm1Comm(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
mscomm1.InBufferCount:=0;
mscomm1.RThreshold:=1;
mscomm1.InputLen:=0;
Mscomm1.Settings :='9600,n,8,1';
Mscomm1.CommPort :=1;
try
mscomm1.PortOpen:=true;
except
end;
end;

procedure TForm1.MSComm1Comm(Sender: TObject);
var
str:string;
len:word;
begin
str:=mscomm1.Input;
len:=mscomm1.InBufferCount;
memo1.Lines.Add(str+inttostr(len));
end;

procedure TForm1.Button2Click(Sender: TObject);
begin

mscomm1.Output:='212312312312';

end;

end.
//代码没
suuare 2005-04-04
  • 打赏
  • 举报
回复
贴出你的代码看看
laiqinghe 2005-03-29
  • 打赏
  • 举报
回复
1。你看你的缓冲区大小

2。也可能其他的事件 例如别的线程 在接收 数据
xinqingbucuo 2005-03-29
  • 打赏
  • 举报
回复
自己顶一下

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧