如何使用GDI+装载图片对象(支持png图片)

#include <windows.h> 
 
// Gdiplus 
#pragma comment( lib, "gdiplus.lib" ) 
#include <gdiplus.h> 
 
static const wchar_t* filename= L"C:\\WINDOWS\\Web\\Wallpaper\\Autumn.jpg"; 
 
int main( void ) 
{ 
    // Start Gdiplus 
    Gdiplus::GdiplusStartupInput gdiplusStartupInput; 
    ULONG_PTR gdiplusToken; 
    Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); 
 
    // Load the image 
    Gdiplus::Image* image = Gdiplus::Image::FromFile( filename ); 
 
    // do something with your image 
    // ... 
 
    // delete the image when done 
    delete image; image = 0; 
 
    // Shutdown Gdiplus 
    Gdiplus::GdiplusShutdown(gdiplusToken); 
} 

你可能感兴趣的:(如何使用GDI+装载图片对象(支持png图片))