procedure TForm1.Button1Click(Sender: TObject);
begin
senddata(edit1.text); 发送edit1中的字符串
edit2.Text :=recdata; 接受到的字符串显示在edit2中procedure senddata(s:string); 发送函数没有问题
var comandstr:string;
begin
comandstr:=s+char(13);
form1.comm1.writecommdata(pchar(ComandStr),length(ComandStr));
end;procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;接受函数 edit2不能显示收到的字符串 BufferLength: Word);
begin
move(Buffer^, PChar(@RecData[1])^, BufferLength);
end;
begin
senddata(edit1.text); 发送edit1中的字符串
edit2.Text :=recdata; 接受到的字符串显示在edit2中procedure senddata(s:string); 发送函数没有问题
var comandstr:string;
begin
comandstr:=s+char(13);
form1.comm1.writecommdata(pchar(ComandStr),length(ComandStr));
end;procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;接受函数 edit2不能显示收到的字符串 BufferLength: Word);
begin
move(Buffer^, PChar(@RecData[1])^, BufferLength);
end;
解决方案 »
- 怎么判断TreeView前面加的复选框是否处于选中状态?
- 一个黑色的jpg图片,中间有一块白色的长方形区域,如何得到这个长方形的长宽及left 及top值呢
- C/C++ 技术高级Q群:7235686
- 有请 halfdream(哈欠) 帮忙。
- &&&&&&&&&&&&&&关于判断网络上的指定文件的问题&&&&&&&&&&&& 马上结帐
- 初次接触delphi,请大虾给点经验和教程!
- 怎么样在主Exe和动态调用的Package中使用和共享全局变量参数?
- 求关于线程的资料
- 我用来检测对方是否断线的数据bb发不出去?
- 急急急!!怎样在delphi中获取正在拨号的用户名和密码????
- 表转移问题
- 截取图标的问题
spcom代码修改如下:
constructor TComm.Create( AOwner: TComponent );
begin
inherited Create( AOwner ); ReadThread := nil;
WriteThread := nil;
hCommFile := 0;
hCloseEvent := 0;
FSendDataEmpty := True; FCommName := 'COM1';
FBaudRate := 9600;
FParityCheck := False;
FOutx_CtsFlow := False;
FOutx_DsrFlow := False;
FDtrControl := DtrEnable;
FDsrSensitivity := False;
FTxContinueOnXoff := True;
FOutx_XonXoffFlow := False;
FInx_XonXoffFlow := False; 改为False
FReplaceWhenParityError := False;
FIgnoreNullChar := False;
FRtsControl := RtsEnable;
FXonLimit := 500;
FXoffLimit := 500;
FByteSize := _8;
FParity := None;
FStopBits := _1;
FXonChar := chr($11); // Ctrl-Q
FXoffChar := chr($13); // Ctrl-S
FReplacedChar := chr(0);
FReadIntervalTimeout := 5;
FReadTotalTimeoutMultiplier := 0;
FReadTotalTimeoutConstant := 0;
FWriteTotalTimeoutMultiplier := 0;
FWriteTotalTimeoutConstant := 0; if not (csDesigning in ComponentState) then
FHWnd := AllocateHWnd(CommWndProc)
end;就OK了,我遇到过这个问题的
move(Buffer^, PChar(@RecData[1])^, BufferLength);
edit2.text:=RecData