好的,使用我链接的Base64解码器的信息和Ben Straub链接的示例,我让它工作了
using namespace Gdiplus; // Using GDI+
Graphics graphics(hdc); // Get this however you get this
std::string encodedImage = "<Your Base64 Encoded String goes here>";
std::string decodedImage = base64_decode(encodedImage); // using the base64
// library I linked
DWORD imageSize = decodedImage.length();
HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, imageSize);
LPVOID pImage = ::GlobalLock(hMem);
memcpy(pImage, decodedImage.c_str(), imageSize);
IStream* pStream = NULL;
::CreateStreamOnHGlobal(hMem, FALSE, &pStream);
Image image(pStream);
graphics.DrawImage(&image, destRect);
pStream->Release();
GlobalUnlock(hMem);
GlobalFree(hMem);