Sign in to follow this  
SonicD007

TransparentBlt error getting on my nerves...

Recommended Posts

SonicD007    464
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 this post


Link to post
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 this post


Link to post
Share on other sites
SonicD007    464
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 this post


Link to post
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 this post


Link to post
Share on other sites
SonicD007    464
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 this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this