From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: win32 interfacing check (SetClipboardData)
Date: Wed, 30 Aug 2017 18:04:04 +0200
Date: 2017-08-30T18:04:04+02:00 [thread overview]
Message-ID: <oo6nlo$dcf$1@gioia.aioe.org> (raw)
In-Reply-To: 59a5ce50$0$7168$426a74cc@news.free.fr
On 29/08/2017 22:28, Xavier Petit wrote:
> Hi, I would like to know if this win32 code is “correct” from your PoV
> or could be written in a better way, especially this block :
>
> declare
> Tmp : Wide_String (1 .. Source'Length + 1) with Address => AMem;
> begin
> Tmp := Source & Wide_Character'First;
> end;
It looks OK. Except that formally Wide_String is UCS-2 and Windows is
UTF-16.
I would use UTF-8 encoded string as the input and recode it into UTF-16
to have CF_UNICODETEXT, e.g. by using MultiByteToWideChar.
> Complete code : https://pastebin.com/raw/CnUbGVyk
>
> It copies the Source Wide_String in the Windows clipboard and needs
> Win32Ada & -gnatW8 -gnata compilation flags (in order to get correct
> unicode characters and assertions enabled)
Why should it need gnatW8 or gnata? You get characters by encoding them,
I suppose.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2017-08-30 16:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 20:28 win32 interfacing check (SetClipboardData) Xavier Petit
2017-08-30 16:04 ` Dmitry A. Kazakov [this message]
2017-08-30 18:41 ` Xavier Petit
2017-08-30 21:17 ` Dmitry A. Kazakov
2017-09-01 12:51 ` Xavier Petit
2017-09-01 13:10 ` Dmitry A. Kazakov
2017-09-02 9:38 ` Xavier Petit
2017-09-02 12:29 ` Dmitry A. Kazakov
2017-08-31 1:41 ` Randy Brukardt
2017-09-01 12:53 ` Xavier Petit
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox