my project have a bitmap.but the bitmap is too big.i want it small.so i change the bitmap format from bmp to gif.than i add this gif to my project as a source.when my program is runing,i want change the picture format from gif to bmp agan.i write a function like tihs:
BOOL CLoadDlg::GIFToBMP(CString& strGIFFile,CString& strBMPFile)
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
CLSID encoderClsid;
GetEncoderClsid(L"image/bmp", &encoderClsid); //i copy the "GetEncoderClsid"function from GDI+ SDK.
//Image image(strGIFFile.AllocSysString());
HRSRC hrsc = FindResource(NULL, MAKEINTRESOURCE(IDR_GIF1), "GIF"); //"IDR_GIF1"is my source-id of GIF .
HGLOBAL hG = LoadResource(NULL, hrsc);
//hG = LockResource(hG);
IStream* pStmImage = NULL;
CreateStreamOnHGlobal(hG, TRUE, &pStmImage);
Image image(pStmImage);
Status stat = image.Save(strBMPFile.AllocSysString(),&encoderClsid,NULL);
GdiplusShutdown(gdiplusToken);
if(stat == Ok)
return TRUE;
else
return FALSE;
}
but when i call this function,it have no effect...
please help me,where is wrong.