Mirror

Copy a WideString to the clipboard (Views: 101)

Problem/Question/Abstract:

I must copy a Unicode string to clipboard. How?

Answer:

Use

Clipboard.SetAsHandle(CF_UNICODETEXT, hUnicodeHandle);

Here's the small code snippet:

{ ... }
mem := GlobalAlloc(GMEM_MOVEABLE + GMEM_DDESHARE, SelLen);
ptr := GlobalLock(mem);
Move(PWideChar(SelText)^, ptr^, SelLen);
GlobalUnlock(mem);
Clipboard.SetAsHandle(CF_UNICODETEXT, mem);
{ ... }


<< Back to main page