CBitMap動态加載本地檔案夾中的BMP圖檔
bool LoadBmpPic(const CString strBmpPath, CBitmap&bmp)
{
HBITMAP bitmap;
try
{
bmp.Detach();
//從檔案路徑加載圖檔
bitmap =(HBITMAP)::LoadImage(NULL,strBmpPath, IMAGE_BITMAP, 0, 0,
LR_CREATEDIBSECTION|LR_LOADFROMFILE|LR_DEFAULTSIZE);
if(bmp.Attach(bitmap))
{
return true;
}
}
catch(...)
{
return false;
}
return true;
}