int GetEncoderClsid(const WCHAR *format, CLSID *pClsid)
{
int nRet = -1;
ImageCodecInfo * pCodecInfo = NULL;
UINT nNum = 0,nSize = 0;
GetImageEncodersSize(&nNum,&nSize);
if (nSize<0)
{
return nRet;
}
pCodecInfo = new ImageCodecInfo[nSize];
if (pCodecInfo==NULL)
{
return nRet;
}
GetImageEncoders(nNum,nSize,pCodecInfo);
for (UINT i=0; i<nNum; i++)
{
if (wcscmp(pCodecInfo[i].MimeType,format)==0)
{
*pClsid = pCodecInfo[i].Clsid;
nRet = i;
delete[] pCodecInfo;
return nRet;
}
else
{
continue;
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载