Have you faced error while loading BMP from disk???

J

Jigar Mehta

Hye friends!!
Jigar Mehta from India. Currently I am loading one BMP file around 2.5
MB from the disk from my VC program and show it to its DC... But while
CBitmap object tries to load it by LoadBitmap("c:\\my.bmp"); it gives
error... I get error code of 1814.. I have also tried same program with 90K
BMP file but in that also, it gives the same error...

If you have faced this kind of error, please suggest me the solution...

Herewith, I am appending my code for loading file and displaying it to
DC, if there is any change in code please reply me..

Thank you...

--
Jigar Mehta
(e-mail address removed)

--------------------------------------
//Code : Jigar Mehta
//Date : 31-12-03

CBitmap bmp;
if(bmp.LoadBitmap("c:\\test1.bmp"))
{
CDC dcMemory;
dcMemory.CreateCompatibleDC(GetDC());
dcMemory.SelectObject(&bmp);
GetDC()->BitBlt(0,0,1152,864,&dcMemory,0,0,SRCCOPY);
}
else
{
DWORD ptr;
ptr = GetLastError();
MessageBox("Error..");
}

//That's it!!!
 
J

Jeff Partch [MVP]

Jigar Mehta said:
Hye friends!!
Jigar Mehta from India. Currently I am loading one BMP file around 2.5
MB from the disk from my VC program and show it to its DC... But while
CBitmap object tries to load it by LoadBitmap("c:\\my.bmp"); it gives
error... I get error code of 1814.. I have also tried same program with 90K
BMP file but in that also, it gives the same error...

If you have faced this kind of error, please suggest me the solution...

I could be overlooking it, but I don't see where CBitmap::LoadBitmap is
documented to take a pathspec: only a string or numeric resource identifier.
WinError.h says the value 1814 is assigned to ERROR_RESOURCE_NAME_NOT_FOUND,
which would tend to support this. I think you might be better served if you
were to LoadImage/LR_LOADFROMFILE and call CBitmap::Attach (if you need to).
 
Top