델파이로 전문송수신하는 프로그램을 맹글고 있는데여..
cpp를 호출해서 메시지를 송신하는 부분에서 잘안되서여..
record형 pointer를 선언하고,
edit1.text내용을 전송하는데 전송하면 space만 가고 실제내용은 안갑니다.
고수님덜 도와주세여..초보라...미리답변감사해여..
----------------
type
pident = ^identrec;
identrec = packed record
ident : string[10] ;
refcount : string[10];
end;
type
pctPkt = array [1..100] of char;
..........
function MgsWrite(wrt_buff: pointer; rtn_buff: pointer): integer stdCall; external 'MsgSend.dll';
// CPP로 작성된 dll을 호출.. msg_send int MgsWrite(char *wrt_buff, char *rtn_buff)
............
var
WrtBuff : pident;
RtnBuff : ^pctPkt;
................
procedure TForm1.Button2Click(Sender: TObject);
var
str1, str2 : string;
i,j,k,l,MsgLen : integer;
Maxlen : integer;
begin
Maxlen := 10;
new(WrtBuff );
new(RtnBuff);
try
try
j := length(trim(edit1.Text));
str1 := edit1.Text ;
k := length(trim(edit2.Text));
str2 := edit2.Text ;
for i:= j + 1 to Maxlen do
str1 := str1 + #32;
for l:= k + 1 to Maxlen do
str2 := str2 + #32;
WrtBuff^.ident := str1;
WrtBuff^.refcount := str2;
begin
Memo1.Lines.Add(WrtBuff^.ident + WrtBuff^.refcount);
MsgLen := MsgWrite(WrtBuff,RtnBuff); // 메시지를 write하고 메시지길이를 return받음
Edit3.Text := IntToStr(MsgLen );
end;
except
on E: Exception do
Memo1.Lines.Add(Edit1.Text + Edit2.Text);
end;
finally
dispose(WrtBuff);
dispose(RtnBuff);
end;
end;
pident = ^identrec;
identrec = packed record
ident : array[0..9]of char ;
refcount :array[0..9]of char;
end;
이렇게 변경하셔서 해보시길 바랍니다.