Posted on 2008-06-27 11:47
若我 閱讀(1041)
評論(0) 編輯 收藏 引用
GDI+提供了GdiplusStartup和 GdiplusShutdown 函數來進行初始化和完成清理工作。你必須在調用其他的GDI+函數之前,調用GdiplusStartup函數,在完成GDI+工作后調用GdiplusShutdown 。
具體的可以看下面的MSDN上的例子:
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;
INT main()
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
Image* image = new Image(L"FakePhoto.jpg");
printf("The width of the image is %u.\n", image->GetWidth());
printf("The height of the image is %u.\n", image->GetHeight());
delete image;
GdiplusShutdown(gdiplusToken);
return 0;
}
具體的使用方法,可以參考MSDN的說明。