comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: win32ada coverage
Date: Sun, 05 Apr 2009 05:58:29 GMT
Date: 2009-04-05T05:58:29+00:00	[thread overview]
Message-ID: <9MXBl.525056$Mh5.400074@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: 0c1ee36a-67a7-4bf1-9a38-46ea9eae7cf2@s12g2000prc.googlegroups.com

An easy answer is to create a wrapper file "load_image.c". This is needed 
because LoadImage(A/W) are in some API versions a macro which can not 
be directly access by Ada.  Then  use the "pragma Import" statement.

Note: Correction may be needed based on your packages and header files.

--
-- Insert into you Win32 package
--

  --  request Ada to automatically include the C object file that 
  --  contains the wrapper for this routine.

  pragma Linker_Options ( "load_image.o" ) ; 
                                  
  function LoadImage ( HINSTANCE hinst ;
                       LPCTSTR lpszName ;
                       UINT uType ;
                       int cxDesired ;
                       int cyDesired ;
                       UINT fuLoad ) return HANDLE ;

    pragma Import ( C, LoadImage, "LoadImage" ) ;

    ...




/*
 * load_image.c  -- LoadImage wrapper 
 */
#include <windows.h>

  HANDLE LoadImage ( HINSTANCE hinst,
                     LPCTSTR lpszName,
                     UINT uType,
                     int cxDesired,
                     int cyDesired,
                     UINT fuLoad );
    {
#ifdef UNICODE
      return LoadImageW ( hinst, lpszName, uType,
                          cxDesired, cyDesired, fuLoad ) ;
#else
      return LoadImageA ( hinst, lpszName, uType,
                          cxDesired, cyDesired, fuLoad ) ;
#endif // !UNICODE 
    }












In <0c1ee36a-67a7-4bf1-9a38-46ea9eae7cf2@s12g2000prc.googlegroups.com>, xiehang@gmail.com writes:
>Yea I know the W/A trick, but the win32ada I have does not have
>LoadImageA nor LoadImageW.
>
>Does your version of win32ada have them?
>
>-Hang
>
>Jerry van Dijk <je...@jerryware.nl> wrote:
>> a...@anon.org (anon) writes:
>> > Win32Ada provides only a subset of common routines. Version 3.0 was cre=
>ated
>> > back in 1999, so any additional routines that was added in XP or Vista =
>must
>> > be added to the package or Imported into your program.
>>
>> Although SetWindowRgn is indeed missing from from Win32Ada (it was added =
>with
>> Windows 2000), LoadImage is an alias for either LoadImageA or LoadImageW,
>> depending on whether you are in unicode mode or not.
>>
>> --
>> -- =A0Jerry van Dijk
>> -- =A0Leiden, Holland
>> --
>> -- =A0The early bird may get the worm, but the second mouse gets the chee=
>se!!




  reply	other threads:[~2009-04-05  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03 21:08 win32ada coverage xiehang
2009-04-03 22:51 ` anon
2009-04-04  0:52   ` xiehang
2009-04-04  6:38   ` Jerry van Dijk
2009-04-05  4:30     ` xiehang
2009-04-05  5:58       ` anon [this message]
2009-04-05 10:44       ` Jerry van Dijk
replies disabled

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