Win32 TransparentBlt()

Started by
3 comments, last by Calabi 16 years, 1 month ago
I'm reading the book Beginning Game Programming by Michael Morrison and I'm trying to draw a transparent sprite. I get an error saying that TransparentBlt() is undeclared, but I've included libmsimg32.a in the project options (using Dev-C++). I checked the project file on the disc and it include libwinmm.a too (but doesn't say why). Is there something I'm missing?
Advertisement
I'm guessing it's a problem with your version macros. With Win32, you have to define macros that state what your minimum required operating system version is, and these macros cause the headers to include functionality that was introduced in that OS version. However I'm not sure if there's anything else that's specific to the Mingw versions of the windows headers that DevC++ uses.

Speaking of DevC++...I suggest that when you're done with that book you ditch DevC++ as quickly as possible. It's a dead project, and is notably inferior to other freely-available C++ IDE's like Visual C++ Express and Code::Blocks. I use Visual Studio Standard myself and think it's the best thing since sliced bread, but I've heard very good things about Code::Blocks as well.
Before including windows.h you probably need this line:

#define _WIN32_WINNT 0x0500
Still can't get it. Here's what Dev-C++ is complaining about (tried using Code::Blocks, but get the same thing):

Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Kenny Lethangue\My Documents\Input Demo\Makefile.win"
Executing make...
make.exe -f "C:\Documents and Settings\Kenny Lethangue\My Documents\Input Demo\Makefile.win" all
g++.exe -c Bitmap.cpp -o Bitmap.o -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include"

Bitmap.cpp: In member function `void Bitmap::Draw(HDC__*, int, int, BOOL, COLORREF)':
Bitmap.cpp:209: error: `TransparentBlt' undeclared (first use this function)
Bitmap.cpp:209: error: (Each undeclared identifier is reported only once for each function it appears in.)

make.exe: *** [Bitmap.o] Error 1

Execution terminated
I had this problem before as well, it took me a while to sort it out. As Colin and MJP said TransparentBlt does not function in earlier operating systems.

You need to define the minimal windows operating system that your project will work in.

You could put define before windows.h but I'm not sure if that works. The way I did it was to go directly into the windows.h file and modify the offending statement in that, I think it was in that or a connected file. Its probably not a good idea to do it that way, but who cares about the older windows.

More info:

http://msdn2.microsoft.com/en-us/library/aa383745(VS.85).aspx

This topic is closed to new replies.

Advertisement