Using Win32 API

Started by
16 comments, last by programering 17 years, 6 months ago
Which are the standard for Win32 style coding for drawing bitmaps and pictures? My book "Windows Game Programming for Dummies" doesn't cover it in chapter 5 as it should. Is there two kinds to use? BITMAP and HBITMAP? To use HBITMAP I think one write: <code> HBITMAP hBmp = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP_ID)); </code> Is HBITMAP used for bitmaps in resources? But how draw/blit it then I don't really know. Thanks. [Edited by - programering on October 18, 2006 10:05:29 PM]
Advertisement
Just a hint - I tend to consider "for dummies" books to be crap just on general principles. if you google for LoadBitmap on the microsoft site you get all the information you need, probably a much better resource than the book. You sound as if you don't know if there is another type BITMAP. I would guess not, based on a quick skim-read of the above link(not really sure though).
Thank you. rating++;

I've tried to search msdn for documentation, but never found any good.
But you've found that good documentation that I was looking for.
What did you search on? Edit: Ok. you searched for LoadBitmap
General Tip: If you need info about win32 api method xxx, Google: site:microsoft.com xxx. Works every time.
The HBITMAP LoadBitmap(hInstance,BITMAP_RES_ID); only loads bitmaps from your app's resources.
I need to load bitmaps from file.
Quote:Original post by DaBookshah
General Tip: If you need info about win32 api method xxx, Google: site:microsoft.com xxx. Works every time.


Isn't that porn?
See answer here of how to load and display a BMP file
http://support.microsoft.com/kb/q158898/
It's in french :), but cond don't lie...
See HERE too.


French?
I need to load a bitmap from a FILE *pFile ptr, how todo that?
And how to blit it? The prototype for blitting takes a HDC.
BOOL BitBlt(
HDC hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
DWORD dwRop // raster operation code
);
To convert it seems to be a bit complicated.

BTW, what the difference between BITMAP/HBITMAP and HDC?

The only image format that Win32 API seems to support is just *.bmp, why?
Quote:Original post by programering
I need to load a bitmap from a FILE *pFile ptr, how todo that?
And how to blit it? The prototype for blitting takes a HDC.
BOOL BitBlt(
HDC hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
DWORD dwRop // raster operation code
);
To convert it seems to be a bit complicated.

BTW, what the difference between BITMAP/HBITMAP and HDC?

The only image format that Win32 API seems to support is just *.bmp, why?


because figuring out how to load other formats is generally pretty trivial. (i don't even understand why it has functions for loading .bmp)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

This topic is closed to new replies.

Advertisement