HBITMAP handle = (HBITMAP) LoadImage (0,_T("d:\\LENA.BMP"),IMAGE_BITMAP,0,0,0);
ASSERT (handle);
CBitmap m_bitmap;
m_bitmap.Attach(handle);
BITMAP image;
m_bitmap.GetBitmap(&image);
但是在运行时 输出bitmap.bmwidth时候 出错了 assert(handle)出错 像是没能成功装载
求帮助啊
ASSERT (handle);
CBitmap m_bitmap;
m_bitmap.Attach(handle);
BITMAP image;
m_bitmap.GetBitmap(&image);
但是在运行时 输出bitmap.bmwidth时候 出错了 assert(handle)出错 像是没能成功装载
求帮助啊
用GetLastError看是是什么错误造成的.
LR_LOADFROMFILE: Loads the image from the file specified by the lpszName parameter. If this flag is not specified, lpszName is the name of the resource.如果参数为NULL,则会把“d:\\LENA.BMP”当做一个BPM的文件名而不是文件路径+文件名,你的这个参数为NULL,又不存在d:\\LENA.BMP的BMP文件,所以handle为NULL,ASSERT就通不过了。
这个我用过,温习一下,谢谢楼上