unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CPort, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
ComPort1: TComPort;
procedure Button1Click(Sender: TObject);
procedure ComPort1RxBuf(Sender: TObject; const Buffer; Count: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ComPort1.Open;
ComPort1.WriteStr('AT'+#13);
ComPort1.OnRxBuf:=ComPort1RxBuf;
end;procedure TForm1.ComPort1RxBuf(Sender: TObject; const Buffer;
Count: Integer);
begin
showmessage('ok');
end;end.
********************************************************************
上面是我写的测试程序,为什么RxBuf没有反应呢??RxChar就可以用
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CPort, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
ComPort1: TComPort;
procedure Button1Click(Sender: TObject);
procedure ComPort1RxBuf(Sender: TObject; const Buffer; Count: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ComPort1.Open;
ComPort1.WriteStr('AT'+#13);
ComPort1.OnRxBuf:=ComPort1RxBuf;
end;procedure TForm1.ComPort1RxBuf(Sender: TObject; const Buffer;
Count: Integer);
begin
showmessage('ok');
end;end.
********************************************************************
上面是我写的测试程序,为什么RxBuf没有反应呢??RxChar就可以用
解决方案 »
- 关于DELPHI三层数据库编程中中间层服务器的设置函数
- 封装VS做的DLL的回调怎么返回给应用程序?
- 关于日期的问题,谁比较熟悉啊.
- 执行存储过程中出错的时候,前台程序显示不了错误信息!如何解决?
- Delphi5使用ADO总是遇到这个错误,怎么解决?
- 奇怪的DELPHI问题,高手都来看看:)
- 怎么样在stringgird中的cell中插入一个speedbutton?
- 请问谁有delph5企业版升级包的安装密码?
- 应用程序打包时出现怪现象? 我很急!!!帮帮我吧!
- 如何选中指定的控件
- 如何等待线程结束再继续下一步?
- 关于用程序一次循环选中dxDBGird多条符合条件的记录?急!! 在大富翁3天没有解决,急啊!
procedure TComThread.DoEvents;
begin
if evError in FEvents then
FComPort.CallError;
if evRxChar in FEvents then
FComPort.CallRxChar;
if evTxEmpty in FEvents then
FComPort.CallTxEmpty;
if evBreak in FEvents then
FComPort.CallBreak;
if evRing in FEvents then
FComPort.CallRing;
if evCTS in FEvents then
FComPort.CallCTSChange;
if evDSR in FEvents then
FComPort.CallDSRChange;
if evRxFlag in FEvents then
FComPort.CallRxFlag;
if evRLSD in FEvents then
FComPort.CallRLSDChange;
if evRx80Full in FEvents then
FComPort.CallRx80Full;
end;这段里就没有CallRxBuf 呀