#include "Funkuhr.h"
EXTERN_C HBITMAP pngload(PCTSTR fname) {
HBITMAP hbm=0;
struct{
HINSTANCE hLib;
int (WINAPI*Startup)(ULONG_PTR*,DWORD[],void*);
int (WINAPI*Shutdown)(ULONG_PTR);
int (WINAPI*CreateBitmapFromFile)(PCWSTR,void**);
int (WINAPI*CreateHBITMAPFromBitmap)(void*,HBITMAP*,COLORREF);
}gdip;
static const char gdipEntries[]={
"gdiplus.dll\0"
"GdiplusStartup\0"
"GdiplusShutdown\0"
"GdipCreateBitmapFromFile\0"
"GdipCreateHBITMAPFromBitmap\0"};
if (dynaload((dynaprocs*)&gdip,gdipEntries)) {
DWORD gdiplusStartupInput[4];
ULONG_PTR gdiplusToken;
void* bm;
#ifdef UNICODE
# define u fname
#else
WCHAR u[MAX_PATH];
MultiByteToWideChar(CP_ACP,0,fname,-1,u,elemof(u));
#endif
__stosd(gdiplusStartupInput,0,4);
gdiplusStartupInput[0]++;
gdip.Startup(&gdiplusToken, gdiplusStartupInput, NULL);
gdip.CreateBitmapFromFile(u,&bm);
gdip.CreateHBITMAPFromBitmap(bm,&hbm,0);
gdip.Shutdown(gdiplusToken);
}
if (gdip.hLib) FreeLibrary(gdip.hLib);
return hbm;
}
Vorgefundene Kodierung: ASCII (7 bit) | 2
|