-
January 16th, 2025, 04:33 PM
#1
GetImageInfo and GetIconInfo?
Is anyone familiar with these two Win32 functions, GetImageInfo() and GetIconInfo() ?
Both return a POD struct of data, which includes HBITMAP handles. So, I assume they don't call a destructor when they go out of scope.
typedef struct _IMAGEINFO {
HBITMAP hbmImage;
HBITMAP hbmMask;
int Unused1;
int Unused2;
RECT rcImage;
} IMAGEINFO, *LPIMAGEINFO;
typedef struct _ICONINFO {
BOOL fIcon;
DWORD xHotspot;
DWORD yHotspot;
HBITMAP hbmMask;
HBITMAP hbmColor;
} ICONINFO;
Microsoft documentation does not explicitly state whether these bitmap handles should be released or not. Nor does it explicitly state whether these bitmap handles are shared or not.
In other words, is this copied data? If so, should one call DeleteObject() on these handles, in every case? Or is this data someone shared with the ImageList they come from? So, if we delete them, it would corrupt the ImageList bitmaps?
I would like to avoid memory leaks after calling these functions, if possible.
-
January 17th, 2025, 11:23 AM
#2
Re: GetImageInfo and GetIconInfo?
Victor Nijegorodov
-
January 17th, 2025, 01:27 PM
#3
Re: GetImageInfo and GetIconInfo?
Thanks for the reply, I must have been looking at older documentation.
"GetIconInfo creates bitmaps for the hbmMask and hbmColor or members of ICONINFO. The calling application must manage these bitmaps and delete them with DeleteObject call when they are no longer necessary."
Are the bitmap handles in GetImageInfo() treated differently than GetIconInfo() ? The setup is the same, but I get the impression, the handles from GetImageInfo() should not be deleted?
-
January 18th, 2025, 03:35 AM
#4
Re: GetImageInfo and GetIconInfo?
Victor Nijegorodov
-
January 18th, 2025, 06:30 AM
#5
Re: GetImageInfo and GetIconInfo?
Thanks again! I think there's multiple versions of these documentations. One mentions it, the other doesn't.
"An application should not call DeleteObject to destroy the bitmaps retrieved by ImageList_GetImageInfo. The system destroys the bitmaps when the application calls the ImageList_Destroy function."
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|