Hi !
Altough I haven't looked in details at your code, at first glance you are
using String and Char instead of AnsiString and AnsiChar.
--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
- Original Message -
From: "Wayne Belshaw"
To:
Sent: Sunday, January 24, 2010 7:43 PM
Subject: [twsocket] TnEmulVT Data Available Routine in Delphi 2010 problems
Hello,
I had a working TnEmulVT/TNScript code module in Delphi 7 using the
recommended "data available" event capture routine. In then upgraded to
Delphi 2010 including the latest ICS package.
In the Delphi 2010 version of the build, I see "garbage" mixed in with my
TMemo screen which at first glance appears to be some type of issue with
UniCode conversion. I'm at a bit of a loss as to the conversion function
to be used in order to recover my data as I can do successfully with
Delphi
7.
Can anyone assist? Here is the "Data Available" event handler that I'm
using that has been previously posted:
procedure TForm1.TnScript1DataAvailable(Sender: TObject; Buf: Pointer;
var Len: Integer);
const
CR = #13;
LF = #10;
var
Start, Stop : Integer;
Buffer : String;
begin
Buffer := PChar(Buf);
begin
if Memo1.Lines.Count = 0 then
Memo1.Lines.Add('');
Start := 1;
Stop := Pos(CR, Buffer);
if Stop = 0 then
Stop := Length(Buffer) + 1;
while Start <= Length(Buffer) do begin
Memo1.Lines.Strings[Memo1.Lines.Count - 1] :=
Memo1.Lines.Strings[Memo1.Lines.Count - 1] +
Copy (Buffer, Start, Stop - Start);
if Buffer[Stop] = CR then begin
Memo1.Lines.Add('');
end;
Start := Stop + 1;
if Start > Length(Buffer) then
Break;
if Buffer[Start] = LF then
Start := Start + 1;
Stop := Start;
while (Buffer[Stop] <> CR) and (Stop <= Length(Buffer)) do
Stop := Stop + 1;
end;
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be