ObjReader Community
SDK programming => 64-bit SDK programming => Topic started by: Patrice Terrier on November 14, 2016, 11:02:47 am
-
GDIPLUS FLAT API
This one uses Explicit Linking to bypass the extra OOP class encapsulation.
How to use it:
Just include the attached gdipflat.h file into your project.
In the application main section
call the helper function hGDIplus = GdipStart() to init GDIPLUS,
and
call the helper function GdipEnd(hGDIplus) to shut down GDIPLUS.
Example:
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
long nRet = 0;
LONG_PTR hGDIplus = GdipStart();
// ALL YOUR CODE GOES THERE
if (hGDIplus) { GdipEnd(hGDIplus); }
return nRet;
}
...
-
That should do it
long GdipCreateHICONFromBitmap (IN LONG_PTR lpImg, OUT HICON &lpIcon) {
long nRet = -1; // Error
lpIcon = 0;
HMODULE hModule = gdiplib();
if (hModule) {
long_proc (LONG_PTR, HICON*);
static zProc hProc;
if (hProc == 0) { hProc = (zProc) GetProcAddress(hModule, "GdipCreateHICONFromBitmap"); }
if (hProc) { nRet = hProc(lpImg, &lpIcon); }
}
return nRet;
}
-
That should do it.
long GdipCreateBitmapFromResource (IN HINSTANCE hInstance, IN WCHAR* sResourceName, OUT LONG_PTR &lpImg) {
long nRet = -1; // Error
lpImg = NULL;
HMODULE hModule = gdiplib();
if (hModule) {
long_proc (HINSTANCE, WCHAR*, LONG_PTR*);
static zProc hProc;
if (hProc == 0) { hProc = (zProc) GetProcAddress(hModule, "GdipCreateBitmapFromResource"); }
if (hProc) { nRet = hProc(hInstance, sResourceName, &lpImg); }
}
return nRet;
}
-
Patrice,
Thank you again.
James