From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,be6e28f854440947 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How to get the mouse position with JEWL? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 21 Oct 2010 21:38:46 +0200 Message-ID: <1dbwvwvv5nn1h.1s4mepzsbnf54.dlg@40tude.net> NNTP-Posting-Date: 21 Oct 2010 21:38:44 CEST NNTP-Posting-Host: 6d1bcc15.newsspool4.arcor-online.net X-Trace: DXC=T>\7D4XCXI>_A0jCfgHO6>4IUK[ On Thu, 21 Oct 2010 19:10:37 +0000 (UTC), tmoran@acm.org wrote: >> Surely it is better to use it from win32ada than making own binding. > There are several reasons: > 1. The program that polled for mouse position is a console mode > program, not an event driven Windows program (which of course would > have watched for a WM_MOUSEMOVE event instead). The call to GetCursorPos > is the only inported function it uses, so win32ada would be overkill. I don't think so. win32ada is a maintained library, it is better to rely on other people's work. Especially because of the 64 vs. 32 bit issue. > 2. The win32ada I have is dated 2002. Much of my Windows code predates > that (it uses CLAW) so I never started using win32ada. Yes, if you are using CLAW. However then, I would expect a call to a CLAW's equivalent of the function. > 3. My copy of win32.ads declares > subtype PVOID is System.Address; > System.Address is not the same as an access value to my preferred Ada > compiler. But PVOID is an address, if an Ada's access type is not, then it cannot be used for PVOID. > 4. I also note that my copy of win32-windef.ads says, in the private part, > pragma Convention(C_Pass_By_Copy, POINT); > which would of course make Jeffrey Carter's suggestion fail. > The possibility of surprises like that makes me leary. It only means that this win32ada (the AdaCore's one?) cannot be used with your compiler. Win32 bindings are not necessarily portable across different Ada compilers. You need win32ada for your compiler and if you don't have it then, yes, you must roll up your own. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de