Bitmap *ResourceToBitmap(const HINSTANCE hInstance, const int id) { HBITMAP hBmp = ::LoadBitmap(hInstance, MAKEINTRESOURCE(id)); if (bBmp == NULL) return NULL; return Bitmap::FromHBITMAP(hBmp, NULL); } void ExampleUse() { Bitmap *pBitmap; pBitmap = ResourceToBitmap(AfxGetInstanceHandle(), IDB_MY_BITMAP); printf("Size is %d x %d\n", pBitmap->GetWidth(), pBitmap->GetHeight()); }
Programming Tips - gdiplus: load a resource bitmap into a GDI+ bitmap
Date: 2008jul12
Library: GDI+
Language: C/C++
OS: Windows
Q. gdiplus: load a resource bitmap into a GDI+ bitmap
A. Use this function: