在EVC下面显示bmp图片
RT哪位大哥有参考代码,发给我下,
分数不多,肯定给
[解决办法]
#include <initguid.h>
#include <imaging.h>
CDC memdc; memdc.CreateCompatibleDC(pDC); CBitmap membmp; membmp.CreateCompatibleBitmap(pDC,M_LCD_WIDTH,M_LCD_HIGHT); CBitmap *Pmembmp=memdc.SelectObject(&membmp); IImagingFactory *pImgFactory = NULL; IImage *pImage = NULL; CoInitializeEx(NULL, COINIT_MULTITHREADED); HRESULT hr; hr = CoCreateInstance(CLSID_ImagingFactory,NULL,CLSCTX_INPROC_SERVER, IID_IImagingFactory,(void **)&pImgFactory); if(SUCCEEDED(hr)) { hr = pImgFactory->CreateImageFromFile(CString(RES_PICMAINPATH) + CString ("background.jpg"), &pImage); if(SUCCEEDED(hr)) { pImage->Draw(memdc.m_hDC,CRect(0,0,M_LCD_WIDTH,M_LCD_HIGHT),NULL); pImage->Release(); } } pDC->BitBlt(0,0,M_LCD_WIDTH,M_LCD_HIGHT,&memdc,0,0,SRCCOPY); pImgFactory->Release(); CoUninitialize(); memdc.SelectObject(Pmembmp); memdc.DeleteDC(); membmp.DeleteObject();
[解决办法]
//在窗口中添加一个静态图片,ID为:IDB_BitMap,将其与m_Bitmap关联
CStatic* m_Bitmap;
HBITMAP hBitmap;
hBitmap=LoadBitmap(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDB_BitMap));
m_Bitmap->SetBitmap(hBitmap);