Public Group

# TransparentBlt error getting on my nerves...

This topic is 4476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

TransparentBlt is really getting on my nerves. When I compile my program, it says it is undefined, but I have just used it yesturday and it compiled fine. I've included msimg32 library, just like my book said to do, and it is undefined. Here is the line of code for it:
TransparentBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0,
GetWidth(), GetHeight(), crTransColor);

I don't understans why it isn't working. I used one of the programs in my computer and recompiled it on here to see if it worked, and it did, but then when I compiled it on like the third try to make sure nothing was wrong(rebuild all) i get that stupid compiler error. Someone please help because its really making me angry. If you need the code to all of the bitmap h and cpp just post. P.S.Language=c++ API=Windows (just the plain old windows.h)Compiler= Dev-CPP

##### Share on other sites
It is probably better for compatibility reasons to just use a monochrome mask image and use bitwise operators flags in BitBlt() to achieve the colorkey effect.

##### Share on other sites
TransparentBlt() is only defined if you target Win98+ or Win2k+. It means that you have to correctly define _WIN32_WINDOWS and _WIN32_WINNT before including windows.h (unless devcpp implemented a different system).

#define _WIN32_WINDOWS 0x0410#define _WIN32_WINNT   0x0500

HTH,

##### Share on other sites
I think I'm gonna try this code on my laptop. It is XP version. The computer I was trying to do this on is Mellenium if it makes any difference. I tried the code you gave me, but I still got the same error :-\ I'll post back if it doesn't work on my laptop.

##### Share on other sites
Simple question: are you sure that your windows.h file contains the declaration of TransparentBlt()? If it does then try to see what surounds it - maybe the define names I gave you are not the right ones. If it doesn't then you'll have to update your win32 package :)

Regards,

##### Share on other sites
I got it! The windows.h file was made for an older version...lol...If anyone else had this problem, just copy and paste this code in your windows.h file just after the fist #endif block of code.
#ifndef WINVER#define WINVER 0x0501#else#if defined(_WIN32_WINNT) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400)#error WINVER setting conflicts with _WIN32_WINNT setting#endif#endif

YAY! Thanks!

[Edited by - SonicD007 on March 17, 2006 11:39:43 AM]

##### Share on other sites
Yeah,I've been having the same problems with Dev - cpp, I managed to find it's declaration in wingdi.h. It's in a #if statement that checks to make sure you have a compatible version of windows so I though it had something to do with WIN_VER not being correct because I was using XP, Hopefully this works thanks

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 37
• 12
• 12
• 11
• ### Forum Statistics

• Total Topics
631413
• Total Posts
2999945
×