comp.lang.ada
 help / color / mirror / Atom feed
From: Xavier Petit <le@vieux.pro>
Subject: Re: win32 interfacing check (SetClipboardData)
Date: Fri, 1 Sep 2017 14:53:55 +0200
Date: 2017-09-01T14:53:54+02:00	[thread overview]
Message-ID: <59a95862$0$31612$426a74cc@news.free.fr> (raw)
In-Reply-To: <oo7pgt$764$1@franka.jacob-sparre.dk>

Le 31/08/2017 à 03:41, Randy Brukardt a écrit :
> For me, using an address clause for anything other than interfacing to
> hardware is wrong. We certainly didn't do anything like this in Claw when
> implementing the clipboard operations. We used instances of
> Unchecked_Conversion to get a pointer of the right type, and then assigned
> into that. (Nowdays, I might use an instance of
> Address_to_Access_Conversions.)
Thank you, this was my first approach (and it worked), but when I tried 
the 'Address trick, I was surprised that it worked too so I removed the 
System.Address_To_Access_Conversions;
Finally I use the To_PWSTR of Win32 (Unchecked_Conversion) which seems 
to me simpler :

AMem := GlobalLock (HMem);
pragma Assert (AMem /= Null_Address);
Length := MultiByteToWideChar (CodePage       => CP_UTF8,
                                DwFlags        => 0,
                                LpMultiByteStr => Addr (Text),
                                CchMultiByte   => -1,
                                LpWideCharStr  => To_PWSTR (Amem),
                                CchWideChar    => Length);
Thanks for the CLAW example


      reply	other threads:[~2017-09-01 12:53 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
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 [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox