Thursday, 5 September 2013

TStringList always doing line break

TStringList always doing line break

I'm developing a hook for keyboard and using SetWindowsHookEx and I add
every keystroke inside a TStringList. To manipulate the keystrokes inside
the TStringList I'm always using the '.Text' property. To add the typed
keystrokes for example I use:
KeyStrokes.Text:= KeyStrokes.Text + AChr;
If I detect a [backspace] then I try to delete the last character in the
StringList using:
KeyStrokes.Text := Copy(KeyStrokes.Text, 1, length(KeyStrokes.Text) - 1);
All this was working while I added inside a TMemo using the same '.Text'
property. But since when I put in TStringList, in the saved Log.txt file
(using .SaveToFile property) I'm getting the logs like this:
H
E
L
L
O
Instead of 'Hello'. I tried '.Append', '.Add' properties and always the
same. And of course, the backspace deleting the last letter doesn't work
anymore... How to put keystrokes correctly? Is that even possible to do in
TStringList?

No comments:

Post a Comment