我是用以下方法加载BMP图像的,你看看能用在你那上面吗?直接用LoadImage函数就好了。
// 加载位图
HBITMAP hBitmap;
hBitmap= (HBITMAP)LoadImage(NULL, "107.bmp", IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if(hBitmap == NULL)
{
MessageBox(hwnd,"LoadImage failed", "Error", MB_ICONERROR);
exit(0);
}
//位图HDC
HDChdc = GetDC(hwnd);
s_hdcMem= CreateCompatibleDC(hdc);
SelectObject(s_hdcMem,hBitmap);
ReleaseDC(hwnd,hdc);
//计算位图宽高
BITMAPbm;
GetObject(hBitmap,sizeof(bm), &bm);
s_nWidth= bm.bmWidth;
s_nHeight= bm.bmHeight;