How would I get the width and height of an HBITMAP?

I need the width and height of an HBITMAP for the BitBlt() function. How would I get those?
Hm... When I try to use a SIZE in GetBitmapDimensionEx(), the compiler tells me that it can't convert from SIZE to LPSIZE. When I use an LPSIZE instead of a SIZE, BitBlt tells me that the expression must have a class type. Here's my (probably horribly, horribly wrong) code:

1
2
3
4
5
6
7
8
9
10
11
12
LPSIZE bmsize = LPSIZE();
GetBitmapDimensionEx(bitmap, bmsize);
SelectObject(hdc, bitmap);
BitBlt(hdc, 
	x, 
	y, 
	bmsize.cx, 
	bmsize.cy, 
	buffer, 
	x, 
	y, 
	SRCCOPY);
Last edited on
Use this:
1
2
3
4
5
6
7
8
9
10
11
12
SIZE bmsize = {0};
GetBitmapDimensionEx(bitmap, &bmsize);
SelectObject(hdc, bitmap);
BitBlt(hdc, 
	x, 
	y, 
	bmsize.cx, 
	bmsize.cy, 
	buffer, 
	x, 
	y, 
	SRCCOPY);
I don't know whether that worked or not because I can't compile the program. Would you happen to know why loading a bitmap from a file would cause the .rc file for the project to give an error saying that it isn't found? Do I need to put it in the .rc? I thought the point of loading from a file was specifically so that it could be loaded from outside of the project.

EDIT: I'm just going to start another thread to figure that one out.
Last edited on
Topic archived. No new replies allowed.