I am trying to show a jpeg image from a resource with GDI+.
I've made a JPEG resource called IDR_JPEG1 in VC++ 7.1 with the type "JPEG".
I've used this code:
Code:
// Graphics declaration above...
LPSTREAM stream;
HGLOBAL imageMem = LoadResource(GetModuleHandle(0), FindResource(GetModuleHandle(0), MAKEINTRESOURCE(IDR_JPEG1), "JPEG"));
CreateStreamOnHGlobal(imageMem, false, &stream);
Image image(stream);
graphics.DrawImage(&image, 0, 0, 50, 50);
It compiles but no image is shown.
But when i do
Code:
Image image(L"res/generals.jpg");
graphics.DrawImage(&image, 0, 0, 50, 50);
the image is shown...
What is wrong ?