Jump to content
Zyga

Executable - multiple icons

Recommended Posts

Hi,
I would like to associate icons with file types that are handled by a LabVIEW built application. To do so, "defaultIcon" key has to take a value of executable path with parameter "resource ID".
The question is how to build in more than one icon with executable?
Examples of LabVIEW keys:
-library: ..\LabVIEW.exe,-8
-llb: ..\LabVIEW.exe,-3
Is it even possible with app builder? Any workaround?
 

Share this post


Link to post
Share on other sites

Sure it's possible.  When you are making your application in the project be sure and add an ICO file to the project that has multiple images in it.  I usually do this to have several resolutions since it sometimes looks better when larger or smaller.  I usually make an icon that has 5 images in it at different resolutions: 128x128, 64x64, 32x32, 24x24, and 16x16.  Then in the application builder settings, pick the icon as the one from the project.  I just opened my EXE in resource hacker and see them all listed under the icon section so I assume you can probably reference them by the index, just like LabVIEW does.  Otherwise you could just include multiple image files in your application builder that just go into support.  Then have your icon be a path to that image file by setting that in the registry.

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, hooovahh said:

 Otherwise you could just include multiple image files in your application builder that just go into support.  Then have your icon be a path to that image file by setting that in the registry.

Tested and it works.

With multiple images stored in a single file it doesn't work. Looks like win uses them just for better apperance. All of them list in the resource hacker as a single group.
When we take a look e.g. on LabVIEW, there is a group for a single file type icon.

Nevertheless specifying icon path explicitly solves my problem.
Thanks!

Share this post


Link to post
Share on other sites

Okay great, thanks for testing this out, I just assumed it would work since it was putting multiple images in the EXE so why shouldn't it be reference like the multiple images in LabVIEW's EXE.

Share this post


Link to post
Share on other sites
On 2/16/2017 at 11:19 PM, Zyga said:

Tested and it works.

With multiple images stored in a single file it doesn't work. Looks like win uses them just for better apperance. All of them list in the resource hacker as a single group.
When we take a look e.g. on LabVIEW, there is a group for a single file type icon.

Nevertheless specifying icon path explicitly solves my problem.
Thanks!

The multiple icons in a single icon resource are only meant for different resolutions, but really all represent the same icon. If the Windows explorer needs to display icons it retrieves the icon resource and looks for the resolution (eg. 32 * 32 pixels, or 16 * 16 for a small icon and if it can't find it, it retrieves the one closest to that resolution and rescales it, which often looks suboptimal.

In order to have multiple icons in an executable you have to add multiple icon resources into the executable, each with its own resource identifier (the number you have to put behind the comma in the registry). The application builder does not provide for a means to do that, but there are many resource editors out there, both as part of development systems such as Visual Studio or LabWindows CVI as well as standalone versions. If you look for standalone versions beware however, many download sites for such tools nowadays are less than honest and either pack lots of adware into the download or outright badware that you definitely do not want to have on your computer.   

Edited by rolfk

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.