一、获取编、解码器信息
获取编码器信息
开发人员可以使用诸如GetImageEncodes来获取系统可用的编码器,用GetImageDecodes来获得系统可用的解码器;由于这两个函数都是一样的,所以我们只看GetImageEncodes函数的定义就好了;
Status GetImageEncoders( UINT numEncoders, UINT size, ImageCodecInfo* encoders );参数说明:
Status GetImageEncodersSize( UINT* numEncoders, UINT* size );参数说明:
FontFamily ff(L"宋体"); Font font(&ff,20,FontStyleRegular,UnitPixel); UINT num; UINT size; ImageCodecInfo *pImageCodecInfo; GetImageEncodersSize(&num,&size); //获取编码器数组 pImageCodecInfo=(ImageCodecInfo*)malloc(size); GetImageEncoders(num,size,pImageCodecInfo); //打印显示 CStringW temp,info; for(UINT j=0;j<num;j++){ temp.Format(L"编码器名称:%s\t文件格式扩展名:%s\t;\n",pImageCodecInfo[j].CodecName,pImageCodecInfo[j].FilenameExtension); info+=temp; } free(pImageCodecInfo); graphics.DrawString(info,-1,&font,PointF(0,0),NULL,&SolidBrush(Color::Green));
Status GetImageDecoders( UINT numDecoders, UINT size, ImageCodecInfo* decoders );参数说明:与GetImageEncoders参数相同;
Status GetImageDecodersSize( UINT* numDecoders, UINT* size );参数说明:
FontFamily ff(L"宋体"); Font font(&ff,20,FontStyleRegular,UnitPixel); UINT num; UINT size; ImageCodecInfo *pImageCodecInfo; GetImageDecodersSize(&num,&size); //获取编码器数组 pImageCodecInfo=(ImageCodecInfo*)malloc(size); GetImageDecoders(num,size,pImageCodecInfo); //打印显示 CStringW temp,info; for(UINT j=0;j<num;j++){ temp.Format(L"解码器名称:%s\t文件格式扩展名:%s\t;\n",pImageCodecInfo[j].CodecName,pImageCodecInfo[j].FilenameExtension); info+=temp; } free(pImageCodecInfo); graphics.DrawString(info,-1,&font,PointF(0,0),NULL,&SolidBrush(Color::Green));