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
Loads a GDI+ image from an application's or DLL's resources.
C
LPVOID SftTree_LoadGDIPlusImageFromResource(HMODULE hInst, LPCTSTR lpszResourceType, LPCTSTR lpszResourceName);
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.
If successful, the return value is a Gdiplus::Image pointer or NULL if the function failed.
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 SftTree_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 SftTree_LoadGDIPlusImageFromResource. Once the image is no longer needed, it can be released using SftTree_FreeGDIPlusImageLoadedFromResource, which frees the associated memory.
LoadGDIPlusImageFromResource provides essentially the same service as the GDI+ Bitmap::FromResource function.
Please note that GDI+ images cannot be defined as BITMAP resources. They must be included as custom resources. The Pictures sample demonstrates how this is accomplished.
HIMAGELIST m_hImgList; /* Imagelist control */ HBITMAP m_BitmapClosed = NULL; // Folder images (if GDI+ is not available) HBITMAP m_BitmapOpen = NULL; HBITMAP m_BitmapLeaf = NULL; // In this example, we are using GDI+ images. // Even though this is a C application, we can embed the images as resources // and use SftTree's SftTree_LoadGDIPlusImageFromResource function to load them // from a resource. // GDI+ images CANNOT be added as BITMAP resources. They are always added with // a custom resource type, in this example we use "PNG". LPVOID m_ButtonExpanded = NULL; // GDI+ images for expand/collapse buttons LPVOID m_ButtonExpandedHot = NULL; // These can simply be cast to (Gdiplus::Image*) LPVOID m_ButtonCollapsed = NULL; LPVOID m_ButtonCollapsedHot = NULL;
Sft_InitPicture(&aPic[0]); Sft_InitPicture(&aPic[1]); Sft_InitPicture(&aPic[2]); if (m_Tree.GetGDIPlusAvailable()) { // In this example, we are using GDI+ images. // GDI+ images CANNOT be added as BITMAP resources. They are always added with // a custom resource type, in this example we use "PNG". m_FolderClosed = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDERCLOSED)); m_FolderOpen = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDEROPEN)); m_FolderLeaf = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDERLEAF)); Sft_SetPictureGDIPlusImage(&aPic[0], m_FolderClosed); Sft_SetPictureGDIPlusImage(&aPic[1], m_FolderOpen); Sft_SetPictureGDIPlusImage(&aPic[2], m_FolderLeaf); } else { m_BitmapClosed.LoadBitmap(MAKEINTRESOURCE(IDB_EXPANDABLE));
See Also C/C++ API | Categories | Notifications