#include <iostream>
#include <Windows.h>
#include <GdiPlus.h>
using namespace std;
#pragma comment(lib, "gdiplus")
int GetEncoderClsid(const TCHAR *format, CLSID *pClsid)
{
//using namespace Gdiplus;
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes
Gdiplus::ImageCodecInfo *pImageCodecInfo = NULL;
Gdiplus::GetImageEncodersSize(&num, &size);
if (size == 0)
return -1;
pImageCodecInfo = (Gdiplus::ImageCodecInfo *)(malloc(size));
if (pImageCodecInfo == NULL)
return -1;
Gdiplus::GetImageEncoders(num, size, pImageCodecInfo);
for (UINT j = 0; j < num; ++j)
{
if (_tcscmp(pImageCodecInfo[j].MimeType, format) == 0)
{
GDI+方式截取系统屏幕
最新推荐文章于 2021-11-02 11:47:06 发布