Groups | Blog | Home
all groups > visual c > december 2003 >

visual c : Have you faced error while loading BMP from disk???


Jeff Partch [MVP]
12/31/2003 8:52:24 AM
[quoted text, click to view]

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).
--
Jeff Partch [VC++ MVP]

Jigar Mehta
12/31/2003 7:40:07 PM
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
jbmehtain@yahoo.co.in

--------------------------------------
//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!!!

AddThis Social Bookmark Button