SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Load a GDI+ image (PNG, TIFF, JPEG, GIF, EMF+ and so on) from an embedded application resource or from a file on disk. The returned pointer is plugged into a SFT_PICTURE slot of type SFT_PICTURE_GDIPLUS.
C
LPVOID SftButton_LoadGDIPlusImageFromResource(HMODULE hInst, LPCTSTR lpszResourceType, LPCTSTR lpszResourceName); LPVOID SftButton_LoadGDIPlusImageFromFile(LPCTSTR lpszFilename);
hInst
Module handle for the resource lookup. Typically the application's instance handle, or a handle returned by LoadLibrary for resources stored in a DLL.
lpszResourceType
Resource type. Use a custom string type (_T("PNG"), _T("JPG"), etc.) declared in the resource script with a matching custom resource entry. RT_BITMAP / RT_RCDATA may also work depending on how the resource was added.
lpszResourceName
Resource name or MAKEINTRESOURCE(IDR_xxx).
lpszFilename
Path to a file readable by GDI+. May be absolute or relative to the current directory.
A pointer to a GDI+ Gdiplus::Image* object on success, NULL on failure. The pointer is opaque to the caller - assign it to SFT_PICTURE.Picture.GDIPlusImage.lpImageObject (or pass it to Sft_SetPictureGDIPlusImage) and free it later with the matching FreeGDIPlusImageLoadedFromResource / FreeGDIPlusImageLoadedFromFile.
The control initializes GDI+ on first use, so the application does not need to call GdiplusStartup itself before calling these helpers.
Each returned pointer must be freed with the function that matches how it was loaded - resource-loaded images go to SftButton_FreeGDIPlusImageLoadedFromResource, file-loaded images to SftButton_FreeGDIPlusImageLoadedFromFile. The free pair is required because the resource path and the file path use different intermediate buffers; freeing through the wrong function leaks memory.
The caller owns the returned image and must keep it alive while any SftButton control is using it. Free it after the last button referencing it has been destroyed or has had its SFT_PICTURE slot cleared.
// Configure SftButton control 2
{
SFTBUTTON_CONTROL Ctl;
Ctl.cbSize = sizeof(SFTBUTTON_CONTROL);
SftButton_GetControlInfo(hwndButton2, &Ctl);
Ctl.nDarkMode = SFTBUTTON_DARKMODE_AUTO;/* automatic dark mode support */
Ctl.Text.align = SFT_PICALIGN_LEFT;/* text horizontal alignment */
g_pImg1 = SftButton_LoadGDIPlusImageFromFile(TEXT("Res\\pic_world_48.png"));
if (g_pImg1) Sft_SetPictureGDIPlusImage(&Ctl.Picture1, g_pImg1);
Ctl.Picture1.align = SFT_PICALIGN_CENTER;
Ctl.Picture1.valign = SFT_PICALIGN_VCENTER;
g_pImg2 = SftButton_LoadGDIPlusImageFromFile(TEXT("Res\\pic_go_32.png"));
if (g_pImg2) Sft_SetPictureGDIPlusImage(&Ctl.Picture2, g_pImg2);
Ctl.Picture2.align = SFT_PICALIGN_LEFT;
Ctl.Picture2.valign = SFT_PICALIGN_VCENTER;
See Also FreeGDIPlusImageLoadedFromResource | FreeGDIPlusImageLoadedFromFile | SFT_PICTURE | GDI+
