首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > WinCE >

在EVC下面显示bmp图片解决思路

2012-03-21 
在EVC下面显示bmp图片RT哪位大哥有参考代码,发给我下,分数不多,肯定给[解决办法]#include initguid.h#in

在EVC下面显示bmp图片
RT哪位大哥有参考代码,发给我下,
分数不多,肯定给

[解决办法]

#include <initguid.h>
#include <imaging.h>



C/C++ code
    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);

热点排行