var
cp :TClipboard;
str :PAnsiChar;
begin
...
str := StrList.GetText(); // StrList is TStringList
...
cp := TClipboard.Create;
cp.Open;
cp.SetTextBuf(str);
cp.Close;
end;
If the tstinglist contains Asian Characters, when copy to and paste
from clipboard to NOTEPAD, the Asian characters become meaningless
characters. How can I copy and paste tstringlist.text corretly?
Thanks in advanced.
You need to repost your message on the Borland news server to make
everybody see it and possibly answer your message.
How to post to Delphi newsgroups:
<http://delphi.wikia.com/wiki/Delphi_Newsgroups>
> cp := TClipboard.Create;
Why are you creating a new TClipboard object? When you add Clipbrd to
your uses clause, one is automatically created for you. (See the
Clipboard function.) If there's a reason to use your own instance, you
need to Free that as well - you show no code for that.
> str :PAnsiChar;
ANSIChar's are eight bit characters - not double byte or Unicode. Are
you sure this allows for your "Asian" character set?
> cp.SetTextBuf(str);
This sets the content of str into the clipboard with a CF_TEXT format.
I suspect you need to be using a CF_UNICODETEXT format. See
SetClipboardData in the Windows help.
Good luck.
Kurt
Thanks. The issue is all about CF_UNICODETEXT, the problem is solved now.