Posted on 2008-06-27 11:47
若我 閱讀(1050)
評論(0) 編輯 收藏 引用
GDI+提供了GdiplusStartup和 GdiplusShutdown 函數(shù)來進行初始化和完成清理工作。你必須在調(diào)用其他的GDI+函數(shù)之前,調(diào)用GdiplusStartup函數(shù),在完成GDI+工作后調(diào)用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的說明。