[DUG] Copy WideString to the clipboard
Csaba Gajo
csaba at enyem.com
Mon Sep 10 04:24:29 NZST 2007
Hi everyone!
I need to copy some text to the clipboard, using the TClipboard object. If
I use the old-fashioned way, I would do it like this:
clp := TClipboard.Create;
clp.SetTextBuf(PChar(MyText.Text));
clp.Free;
However, if I use Unicode components I will have to deal with WideString
and PWideChar. If I try to do
clp.SetTextBuf(PWideChar(MyText.Text));
I will get an error because the Clipboard expects an ordinary PChar.
So how can I copy Unicode text to the clipboard?
I'm using Delphi 5 btw.
Thanks, Csaba
More information about the Delphi
mailing list