HeaderPane
Main
Hide
Share Link
Print

LoadGDIPlusImageFromResource

Loads a GDI+ image from an application's or DLL's resources.

C

LPVOID WINAPI SftBox_LoadGDIPlusImageFromResource(HMODULE hInst, LPCTSTR lpszResourceType, LPCTSTR lpszResourceName);

C++

static LPVOID CSftBox::LoadGDIPlusImageFromResource(HMODULE hInst, LPCTSTR lpszResourceType, LPCTSTR lpszResourceName);

Parameters

hInst

The instance handle of the application or DLL containing the resource.

lpszResourceType

The resource type. Can be a string or an identifier using the MAKEINTRESOURCE macro.

lpszResourceName

The resource name. Can be a string or an identifier using the MAKEINTRESOURCE macro.

Returns

If successful, the return value is a Gdiplus::Image pointer. NULL is returned if GDI+ is not available, the resource cannot be found or the image cannot be loaded or decoded.

Comments

The LoadGDIPlusImageFromResource function loads a GDI+ image from an application's or DLL's resources.

This function is mainly intended for applications written using C. Because Gdiplus is C++ based, C applications don't readily have access to the Gdiplus::Image class and cannot use Bitmap::FromResource to load a GDI+ image. Using SftBox_LoadGDIPlusImageFromResource even C applications can use GDI+ images, without needing access to GDI+ itself.

The application retains ownership of the Gdiplus::Image pointer returned by SftBox_LoadGDIPlusImageFromResource. Once the image is no longer needed, it can be released using SftBox_FreeGDIPlusImageLoadedFromResource, which frees the associated memory.

LoadGDIPlusImageFromResource creates the image from the resource data using the GDI+ Image::FromStream function, so the resource can hold an image in any format supported by GDI+, such as PNG or JPEG.

Please note that GDI+ images cannot be defined as BITMAP resources. They must be included as custom resources.

See Also C/C++ API | Categories | Notifications


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.