That's probably because GDI+ is a C++ only. Why they've done that I don't know, but either way it'll never work in your C file.
The cheaters' way to do it is:-
Code:
LPPICTURE LoadPicture(char *szFilename)
{
LPPICTURE lpPicture;
// This is an OLE function, filename must be in Unicode
#ifndef UNICODE
unsigned short wzFilename[MAX_PATH];
MultiByteToWideChar(GetACP(), MB_PRECOMPOSED, szFilename, -1, wzFilename, MAX_PATH);
#else
char *wzFilename;
wzFilename = szFilename;
#endif
if (OleLoadPicturePath(wzFilename, NULL, 0, 0, &IID_IPicture, (void **)&lpPicture) != S_OK)
return NULL;
return lpPicture;
}
And when you want to show it on a DC:-
Code:
int iHiWidth, iHiHeight; // gives you size in HIMETRICs
BITMAP bmp; // pixel size in here
HBITMAP hbmp;
lpPicture->lpVtbl->get_Width(lpPicture, &iHiWidth);
lpPicture->lpVtbl->get_Height(lpPicture, &iHiHeight);
lpPicture->lpVtbl->get_Handle(lpPicture, (OLE_HANDLE *)&hbmp);
GetObject(hbmp, sizeof(BITMAP), &bmp);
lpPicture->lpVtbl->Render(lpPicture, hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, 0, iHiHeight, iHiWidth, -iHiHeight, NULL);
When you're finished with it, remember to:-
Code:
lpPicture->lpVtbl->Release(lpPicture);
Depending on which version of Windows is being used, you may also need to call CoInitialize().