Lazarus

Programming => General => Topic started by: fatmonk on December 03, 2019, 11:58:20 am

Title: Assigning an icon from a resource
Post by: fatmonk on December 03, 2019, 11:58:20 am
I believe I've added a second icon to my project for use in a file association by adding an icon type resource under Resources in the Project Options dialog.

I want to assign this icon as a FileAssociation.ExtensionIcon but cannot figure out how to assign it.

I can include the second icon as a separate file alongside the exe, but I was hoping that by including it as a resource I could avoid that and just distribute the exe on its own but still have two (or more) different icons available.

FileAssociation.ExtensionIcon is looking for a string so referencing the resource might not be possible...

-FM

Title: Re: Assigning an icon from a resource
Post by: fatmonk on December 03, 2019, 12:16:53 pm
OK, I think I might have figured this out...

When you add the multiple icons as resources, it looks like you can access them as follows:

Code: [Select]
FileAssociation_type1.ExtensionIcon:=Application.ExeName+',0';
FileAssociation_type1.ExtensionIcon:=Application.ExeName+',1';

At least it seems to be working...

-FM
Title: Re: Assigning an icon from a resource
Post by: madref on December 04, 2019, 12:09:01 pm
Is this only under windows?
Or does this also work with MacOS?
Title: Re: Assigning an icon from a resource
Post by: fatmonk on December 04, 2019, 12:31:39 pm
I'm only working under Windows and don't have a Mac to try on.

I don't have Windows in my uses declaration, though, so I don;t believe I'm using anything Windows specific in my code.

-FM
TinyPortal © 2005-2018