Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Dev-C++ and InvisibleBlt | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
RoboticParanoia

Cheep-cheep
Level: 23

Posts: 174/184
EXP: 60582
For next: 7141

Since: 03-23-04
From: Texas

Since last post: 150 days
Last activity: 150 days
Posted on 05-02-05 04:48 AM Link | Quote
So, I recently bought a book on WinAPI32 programming with C++. I typed up the examples in the book, because I'm serious with this one.

However, I can't get the compiler to compile a piece of code (a source code to handle bitmap loading) with TransparentBlt in it. I linked it to the msimg32 library file and to the gdi32 library as well.

Basically, I get an error saying that TransparentBlt needed to be undeclared, even though it's cousin, BitBlt wasn't even mentioned in the code before it was used, with TransparentBlt.

This is the exact error:
"In member function 'void Bitmap:raw(HDC_*, int, int, COLORREF)': TransparentBlt is undeclared (first use function). (Each undeclared identifier is only reported once for each function it appears in).

The bad thing is that it's not even my code. I got it off the disc, because he didn't create a listing in the book on how to actually load the bitmap.

I tried to compile it in Visual C++, but I got a bevy of errors and a few other things attatched (and it changed all my ;s to *s).

So, right now, I included "wingdi.h" to a bunch of different files, and still nothing.

So, anybody have any advice? I'd post the source code, but technically it's in eight different files and most of these are over 50 lines long.

This is kinda frusterating, especially since the error is in their own source code.




(edited by RoboticParanoia on 05-01-05 12:19 PM)
Parasyte

Bullet Bill
Level: 35

Posts: 487/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 05-02-05 05:38 AM Link | Quote
You should not implicitly link with the msimg32 or gdi32 libs. When you link the object files, the libs should be passed using the -l switch, like so:

-lgdi32 -lmsimg32

But since you're compiling with an IDE, rather than the command line, you'll have to find out how to set it up from within the IDE. I cannot help in that regard, because I don't use any such IDEs.

Other than that, it would probably help quite a bit to see an example of the source which is generating the error. The information you provided just is not enough to give an accurate answer.
RoboticParanoia

Cheep-cheep
Level: 23

Posts: 178/184
EXP: 60582
For next: 7141

Since: 03-23-04
From: Texas

Since last post: 150 days
Last activity: 150 days
Posted on 05-02-05 06:29 AM Link | Quote
void Bitmap:raw(HDC hDC, int x, int y, BOOL bTrans, COLORREF crTransColor)
{
if (m_hBitmap != NULL)
{
// Create a memory device context for the bitmap
HDC hMemDC = CreateCompatibleDC(hDC);

// Select the bitmap into the device context
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_hBitmap);

// Draw the bitmap to the destination device context
if (bTrans)
TransparentBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, GetWidth(), GetHeight(), crTransColor);
else
BitBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY);

// Restore and delete the memory device context
SelectObject(hMemDC, hOldBitmap);
DeleteDC(hMemDC);
}


Here is where TransparantBlt is...but, now I get a Linker error, and it says it's an undefined reference...maybe I'm using it wrong or something.
sloat

Level: 16

Posts: 46/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 05-02-05 06:53 AM Link | Quote
Before you include windows.h, try adding
#define _WIN32_WINNT 0x0500

That tells the headers you're compiling for win2k. Really, it can just be defined as anything greater than 0x0400, but if I were you I would do everything in my power to discourage use of windows 9x.

Also, that function has a well known memory leak on 95 and 98, and may not work very well at all. If you want something compatible across all versions of windows, check out this MSDN article.


(edited by sloat on 05-01-05 01:56 PM)
RoboticParanoia

Cheep-cheep
Level: 23

Posts: 179/184
EXP: 60582
For next: 7141

Since: 03-23-04
From: Texas

Since last post: 150 days
Last activity: 150 days
Posted on 05-02-05 07:29 AM Link | Quote
I'm going to try that fix...damn, I hope this works.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - Dev-C++ and InvisibleBlt | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.005 seconds.