hColorImg=LoadImage(NULL,CBmpFName,IMAGE_BITMAP,NULL,NULL,LR_LOADFROMFILE);
GetObject(hColorImg,sizeof(BITMAP),&ColorImgStru);
width= ColorImgStru.bmWidth;
height=ColorImgStru.bmHeight;
hdcColorImg=CreateCompatibleDC(NULL);
ZeroMemory(&pBInfo,sizeof(BITMAPINFO));
pBInfoHead.biSize=sizeof(BITMAPINFOHEADER);
pBInfoHead.biWidth=width;
pBInfoHead.biHeight=height;
pBInfoHead.biPlanes=1;
pBInfoHead.biBitCount=24;
pBInfoHead.biCompression=BI_RGB ;
pBInfoHead.biSizeImage=NULL;
pBInfoHead.biXPelsPerMeter=NULL;
pBInfoHead.biYPelsPerMeter=NULL;
pBInfoHead.biClrUsed=NULL;
pBInfoHead.biClrImportant=NULL;
pBInfo.bmiHeader=pBInfoHead;
CreateDIBSection(hdcColorImg,&pBInfo,DIB_RGB_COLORS,(void**)&pBMBmp,NULL,NULL);
int err=GetLastError();
char texta[256]="";
wsprintf(&texta[0],"%d",err);
MessageBox(NULL,"ERROR",&texta[0],MB_OK);
this gives me error 8 (Not enough storage is available to process this command. ) Bitmap size is 560x503
I can bitBlt hdcColorImg on the screen. so it is loaded ok.
GetObject(hColorImg,sizeof(BITMAP),&ColorImgStru);
width= ColorImgStru.bmWidth;
height=ColorImgStru.bmHeight;
hdcColorImg=CreateCompatibleDC(NULL);
ZeroMemory(&pBInfo,sizeof(BITMAPINFO));
pBInfoHead.biSize=sizeof(BITMAPINFOHEADER);
pBInfoHead.biWidth=width;
pBInfoHead.biHeight=height;
pBInfoHead.biPlanes=1;
pBInfoHead.biBitCount=24;
pBInfoHead.biCompression=BI_RGB ;
pBInfoHead.biSizeImage=NULL;
pBInfoHead.biXPelsPerMeter=NULL;
pBInfoHead.biYPelsPerMeter=NULL;
pBInfoHead.biClrUsed=NULL;
pBInfoHead.biClrImportant=NULL;
pBInfo.bmiHeader=pBInfoHead;
CreateDIBSection(hdcColorImg,&pBInfo,DIB_RGB_COLORS,(void**)&pBMBmp,NULL,NULL);
int err=GetLastError();
char texta[256]="";
wsprintf(&texta[0],"%d",err);
MessageBox(NULL,"ERROR",&texta[0],MB_OK);
this gives me error 8 (Not enough storage is available to process this command. ) Bitmap size is 560x503
I can bitBlt hdcColorImg on the screen. so it is loaded ok.