www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - AlphaBlend (msimg32.lib)

reply Dejan Lekic <dejan nu6.org> writes:
Hi everybody,
few minutes ago i have tried to build a snapshot of FLTK 2.0 on my 
workstation, and failed because there is no msimg32 library in DM C/C++ 
distribution (freely downloadable one).

Does anyone know where to get this library from?

Kind regards

Dejan Lekic
May 10 2006
parent reply Bertel Brander <bertel post4.tele.dk> writes:
Dejan Lekic wrote:
 
 Hi everybody,
 few minutes ago i have tried to build a snapshot of FLTK 2.0 on my 
 workstation, and failed because there is no msimg32 library in DM C/C++ 
 distribution (freely downloadable one).
 
 Does anyone know where to get this library from?

You could try to create one from msimg32.dll found in your windows' system32 folder. It can be done with this command: implib.exe /noi msimg32.lib msimg32.dll -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
May 10 2006
parent reply Dejan Lekic <dejan nu6.org> writes:
Yeah, i did it, i got msimg32.lib, but than i have discovered that 
actual problem lies in old headers... I could not just copy headers from 
  MS PSDK or MinGW's Win32 API package because they are not compatible 
with DM C/C++.
What i did was to declare all AlphaBlend-related types and functions 
inside #if __DMC__ at the top of my C++ sources and everything seemed to 
work until it came to the linking.
Btw. i am using Code::Blocks for this little adventure.
Than i got this:
-------------- Build: fltk-static-debug in windows-dmc ---------------
Linking static library: ..\..\lib\fltk2-debug.lib
Digital Mars Librarian Version 8.00n
Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
Warning: Public '_main' already in library, redefinition ignored.
Error: /PAGESIZE:16 is too small
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

When i added -p32 in the additional link properties (even though it is 
actually a librarian's flag) build passed well.

But, executable does not do anything... How to debug it? It can be bad 
msimg32.lib or somehing else...

Kind regards

Dejan Lekic
May 11 2006
next sibling parent Bertel Brander <bertel post4.tele.dk> writes:
 But, executable does not do anything... How to debug it? It can be bad 
 msimg32.lib or somehing else...

Do you still get the multiple declaration of main warning? To debug it, either buy the IDDE from Digital Mars, or put in some trace statements. -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
May 11 2006
prev sibling parent "Matthew" <matthew hat.stlsoft.dot.org> writes:
I don't know if it's directly germane to your issue, but you can now use
dl_call (from WinSTL sub-project of STLSoft; also one for UNIX in UNIXSTL)
for invoking, in a type-safe manner, any C function from any DLL, in
occasions such as when confronted with not having up-to-date libraries.

For example, AlphaBlend can be invoked thusly:

 HDC    hdcDest;
 int    nXOriginDest;
 int    nYOriginDest;
 int    nWidthDest;
 int    nHeightDest;
 HDC    hdcSrc;
 int    nXOriginSrc;
 int    nYOriginSrc;
 int    nWidthSrc;
 int    nHeightSrc;
 BLENDFUNCTION blendFunction;

 winstl::dl_call<BOOL>( "msimg32.dll"
      , "S:AlphaBlend"
      , hdcDest
      , nXOriginDest
      , nYOriginDest
      , nWidthDest
      , nHeightDest
      , hdcSrc
      , nXOriginSrc
      , nYOriginSrc
      , nWidthSrc
      , nHeightSrc
      , blendFunction);


Note: For safety, dl_call() does a static assert on the type of each
argument, to ensure that it is:
 - fundamental type, or
 - pointer type, or
 - function pointer type.

Some functions, and AlphaBlend is one of them, take arguments of structure
by value. This, by default, causes the static assert to fire. However, the
user may stipulate any type as compatible by specialising the
winstl::is_valid_dl_call_arg traits, as follows:

template <>
struct winstl::is_valid_dl_call_arg<BLENDFUNCTION>
{
 enum { value = 1 };
};

As long as this is defined in the same compilation unit as the function that
invokes AlphaBlend, the code shown above will work correctly.

(Note: the is_valid_dl_call_arg traits mechanism was added in the latest
beta (6), which was released a couple of days ago.)

HTH

Cheers

Matthew



"Dejan Lekic" <dejan nu6.org> wrote in message
news:e3v14o$vha$1 digitaldaemon.com...
 Yeah, i did it, i got msimg32.lib, but than i have discovered that
 actual problem lies in old headers... I could not just copy headers from
   MS PSDK or MinGW's Win32 API package because they are not compatible
 with DM C/C++.
 What i did was to declare all AlphaBlend-related types and functions
 inside #if __DMC__ at the top of my C++ sources and everything seemed to
 work until it came to the linking.
 Btw. i am using Code::Blocks for this little adventure.
 Than i got this:
 -------------- Build: fltk-static-debug in windows-dmc ---------------
 Linking static library: ..\..\lib\fltk2-debug.lib
 Digital Mars Librarian Version 8.00n
 Copyright (C) Digital Mars 2000-2002 All Rights Reserved

 Warning: Public '_main' already in library, redefinition ignored.
 Error: /PAGESIZE:16 is too small
 Process terminated with status 1 (0 minutes, 0 seconds)
 0 errors, 0 warnings

 When i added -p32 in the additional link properties (even though it is
 actually a librarian's flag) build passed well.

 But, executable does not do anything... How to debug it? It can be bad
 msimg32.lib or somehing else...

 Kind regards

 Dejan Lekic

May 27 2006