Article View: borland.public.cppbuilder.nativeapi
Article #2043Clipbored and Unicode
From: Jos�
Date: Sun, 13 May 2007 16:13
Date: Sun, 13 May 2007 16:13
31 lines
1787 bytes
1787 bytes
The clipboard contains text, including Unicode characters. I'm trying to exchange these with my program, but not successfully. I used to do it by typing ^V in a TMemo or a TRichEdit, but I have discovered that this is a sure way to lose Unicode characters. With the help of the help files (often not helpful at all), I tried this: TClipboard *cb=Clipboard(); cb->Open(); int TextHandle = cb->GetAsHandle(CF_TEXT); char *pText = (char *)GlobalLock((HGLOBAL)TextHandle); GlobalUnlock((HGLOBAL)TextHandle); cb->Close(); Again the Unicode characters are replaced by question marks. Perhaps this should be expected, since char* has no space for Unicode. But what else can I do? To write into the clipboard, I found that SetAsHandle (the obvious opposite of GetAsHandle) is unusable. It takes an int as second parameter, and I want to store a lot more. But the following works. I haven't tried it with Unicode yet: TClipboard *cb=Clipboard(); cb->Open(); cb->SetTextBuf(string.c_str()); cb->Close(); -- Jos�
Technical Details
Message-ID:
<qdde43trid2dep05rjl9pu2k2ohufnguf1@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,eee29c0be9200ce9,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII From: Jos� <jose@127.0.0.1> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Clipbored and Unicode Date: Sun, 13 May 2007 18:13:38 +0200 Message-ID: <qdde43trid2dep05rjl9pu2k2ohufnguf1@4ax.com> X-Newsreader: Forte Agent 4.2/32.1117 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 82.75.32.109 X-Trace: newsgroups.borland.com 1179072857 82.75.32.109 (13 May 2007 09:14:17 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail