|
-
Oct 19th, 2023, 04:12 AM
#1
Thread Starter
Lively Member
Is it possible to get an HICON from .ico with multiple images stored in resources
Suppose I have a .ico file stored in resources. This file has, say, 3 icons combined vertically. All of those 3 images have the same size.
Example:

Is there a way to extract each of those files and get an HICON?
LoadImage only gives height and width which is not what I'm looking for.
Basically, I'm trying to avoid to load them separately each with its own resource ID.
Thanks in advance.
-
Oct 19th, 2023, 04:48 AM
#2
Re: Is it possible to get an HICON from .ico with multiple images stored in resources
I'm still not really clear on what you're trying to do... are they separate entries in icon file, or you literally have an e.g. 160x32 image and want 5 HICONs from it?
-
Oct 19th, 2023, 04:58 AM
#3
Thread Starter
Lively Member
Re: Is it possible to get an HICON from .ico with multiple images stored in resources
 Originally Posted by fafalone
I'm still not really clear on what you're trying to do... are they separate entries in icon file, or you literally have an e.g. 160x32 image and want 5 HICONs from it?
Sorry, not sure what is separate entries. My knowledge of Icons are limited.
The .ico file is 45x135.
I would like to use it as a single .ico file and just get unique HICON for each image either by an index, or a x,y value.
Because I want to add them to an imagelist. I know ImageList_Add accepts multiple images but for .bmp file.
I'm trying to avoid to use each icon in its own separate resource ID.
-
Oct 19th, 2023, 06:00 AM
#4
Re: Is it possible to get an HICON from .ico with multiple images stored in resources
...you'd be in danger of exceeding 65,535 images if they had their own id?
You're going to have to use image manipulation APIs to, at a minimum, convert your icon to a bitmap by drawing on an hDC, then use with ImageList_Add, there's no shortcut for this I'm aware of.
-
Oct 19th, 2023, 04:57 PM
#5
Thread Starter
Lively Member
Re: Is it possible to get an HICON from .ico with multiple images stored in resources
I wouldn't say in danger. But I'm doing a lot of control custom/owner drawing. This quickly became cumbersome to manage. If we could somehow manage to do this, will be a lot easier.
I found something and I'm going to leave it here as a reference to this topic just in case somebody else wants to do the same:
https://stackoverflow.com/questions/...uffer-ico-file
https://stackoverflow.com/questions/...ory-on-windows
I think we could use like you said multiple icon entries and then enumerate through then create icons on the fly.
More on this:
Windows have unique method of doing it. If you verify its msstyle.aero, there are a lot of icons stacked up one above the other as .PNG
They use GdiDrawStream for this but this is really a private API.
Thanks for your addition fafalone.
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
|