Using btimap resource from dll
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
I want to use bitmap resource in dll file. If I get bitmap resource ID, LoadLibrary and get the bitmap so I want to draw it. How can I do?
Do the following steps:
CBitmap bmpYourBitmap; // your bitmap
CDC *pDC; // device context for painting
//
// 1. Create a memory device context:
CDC memDC;
memDC.CreateCompatibleDC(pDC);
//
// 2. Select your bitmap intomemDC
:
CBitmap *pOldBmp = memDc.SelectObject(&bmpYourBitmap);
//
// 3. Get the size ofbmpYourBitmap
:
BITMAP bm;
bmpYouBitmap.GetBitmap(&bm);
//
// 4. Paint the bitmap:
pDC->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&memDC,0,0,SRCCOPY);
memDc.SelectObject(pOldBmp);