//Load img
HANDLE img = LoadImage(hInstance, "image.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
HDC imgDc = CreateCompatibleDC(GetDC(hWnd));
SelectObject(imgDc, img);
//When finished
DeleteObject(img);
DeleteDC(imgDc);
c++, How to get the size of an bmp, im using LoadImage...
Hi, with c++, I'm loading an image like so:
How would I get the width and height of the bitmap that I am loading shown above?
Also does my code above look correct, like have i cleaned up the memory etc properly?
Thanks
Ever heard of Google? Really, maybe you should try a bit harder to solve problems by yourself, at least looking at your posting history it seems that way.
This is what I found somewhere with google, I haven't tested it but it should be correct.
BITMAP bm;GetObject (_hBitmap, sizeof (bm), & bm);width = bm.bmWidth;height = bm.bmHeight;
This is what I found somewhere with google, I haven't tested it but it should be correct.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement