如何在我自己的空间中捆绑spcomm

whitehare 2003-07-01 03:27:20
贴上部分代码,
type
TZkjjLink = class(TWinControl)
private
FComm1:TComm;
FImage1:TImage;
FStr1:String;
FStr2:String;
FStr3:String;
FStr4:String;
FStr5:String;
FViewString:String;
rbuf:array[1..6] of byte;
procedure FComm1ReceiveData(Sender: TObject; Buffer: Pointer; BufferLength: Word);
function GetByte(Bit: array of longint ): Byte; //为转换为字节;
function rev(c: Byte):Byte;stdcall;
function ones(ch: Byte):Byte;stdcall;
function verify(addr,order:Byte):Byte;
procedure send_data(ch: Byte);stdcall;
procedure send_addr(ch: Byte);stdcall;
procedure send_order(ch: Byte);stdcall;
{ Private declarations }
protected
{ Protected declarations }
public
Constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
function DisBmp(FileStr : String; ComN : String; Address : Integer) : Integer;
function DispLine(strto : String; ComN : String; Address : Integer) : Integer;
function DisTxt(FileStr : String; ComN : String; Address : Integer) : Integer;
{ Public declarations }
published
property Visible;
{ Published declarations }
end;


constructor TZkjjLink.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FStr1 :='';
FStr2 :='';
FStr3 :='';
FStr4 :='';
FStr5 :='';
// Self.Hide;
FComm1 :=TComm.Create(self);
FComm1.OnReceiveData:=FComm1ReceiveData;
FComm1.BaudRate:=57600;
FComm1.ParityCheck:=True;
FImage1:=TImage.Create(self);
FImage1.Parent:=self;
end;

OnReceiveData不能响应
...全文
25 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
whitehare 2003-07-01
  • 打赏
  • 举报
回复
搞定了,来者有分
whitehare 2003-07-01
  • 打赏
  • 举报
回复
a12345(唯微) FComm1 :=TComm.Create(AOwner);
我试过了,不行。
至于“再看看需要重载消息吗?”能否详细说明
a12345 2003-07-01
  • 打赏
  • 举报
回复
问一下,FComm1 需要急活的吗?如果不的话把
FComm1 :=TComm.Create(self);
改成
FComm1 :=TComm.Create(AOwner);
如何?
再看看需要重载消息吗?
  • 打赏
  • 举报
回复
不能的,我用的也是这个与单片机通讯,没问题的,只是有一点禁告。
你去网上找点资料。

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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