Recent

Author Topic: Add more icons to project  (Read 866 times)

SaraT

  • Jr. Member
  • **
  • Posts: 86
  • A little student
Add more icons to project
« on: March 20, 2020, 11:41:31 pm »
Hello coders

I want to add more than one icon to my project to use the index number (1, 2, ...) in the Windows Registry
but would like to know if it possible to do this.

Code: Pascal  [Select][+][-]
  1. //i.e. to call second icon index from Registry
  2. @%ProgramFiles%\My Project\Application.exe,-1

See attached image.

Many thanks

eljo

  • Sr. Member
  • ****
  • Posts: 408
Re: Add more icons to project
« Reply #1 on: March 20, 2020, 11:55:01 pm »
create an .rc file with all the icons you want to be included in your application and {$R myicons.rc} in your application code somewhere and they will be included.

PS. RC is a text script that describes the resources to be included in your exe search for the format and commands in the online microsoft documentation.

winni

  • Hero Member
  • *****
  • Posts: 2121
Re: Add more icons to project
« Reply #2 on: March 21, 2020, 12:36:00 am »
Hi!

Forget about the registry, that neverending trouble.

Either you use a resource file like eljo said or you save your icons in a TImageList.
The later was discussed here:

https://forum.lazarus.freepascal.org/index.php?topic=39311.0


Winni

lainz

  • Hero Member
  • *****
  • Posts: 3926
  • Leandro Diaz
Re: Add more icons to project
« Reply #3 on: March 21, 2020, 04:25:09 pm »
That icons are for file association?

SaraT

  • Jr. Member
  • **
  • Posts: 86
  • A little student
Re: Add more icons to project
« Reply #4 on: March 24, 2020, 03:45:35 am »
That icons are for file association?

Hi Lainz, yes, that what I need more icons for.
Any idea how to do it?

Thnx

lainz

  • Hero Member
  • *****
  • Posts: 3926
  • Leandro Diaz
Re: Add more icons to project
« Reply #5 on: March 24, 2020, 11:26:08 am »
That icons are for file association?

Hi Lainz, yes, that what I need more icons for.
Any idea how to do it?

Thnx

What I did before was creating an icon dll that is never loaded by my application but it just stores the icons. From registry is used like an exe.

To create that you need an .rc file containing all the icons.

lainz

  • Hero Member
  • *****
  • Posts: 3926
  • Leandro Diaz
Re: Add more icons to project
« Reply #6 on: March 24, 2020, 11:36:39 am »
create an .rc file with all the icons you want to be included in your application and {$R myicons.rc} in your application code somewhere and they will be included.

PS. RC is a text script that describes the resources to be included in your exe search for the format and commands in the online microsoft documentation.

That's all this is the right answer

 

TinyPortal © 2005-2018