How to change the application icon on the Delphi 2010 taskbar

I change the icon of my application to my own icon (32x32 16bit EGA) using:

Project > Option > Applications > Load Icon 

The taskbar icon has changed very well in many Border styles: = bsNone or bsSingle or bsSizeable or bsSizeToolWin or bsToolWindow. But the icon has not changed while I use BorderStyle: = bsDialog.

Please do not tell me to use:

 Application.Icon.LoadFromFile(extractfilepath(application.exename) + '\myicon.ico'); 

Becase I want to send only one EXE file.

PS: I am using Embarcadero Delphi 2010

+4
source share
1 answer

The icon is the icon of the window associated with the taskbar button. So, with Application.MainFormOnTaskbar set to True, this is the icon of the main form. When False is the icon of a hidden application window. To have a different taskbar icon from the main form, you need MainFormOnTaskbar to be False and assign a different Application.Icon icon. This seems to be an easy way around this problem.

If I remember, VCL only sets one icon size. In my experience, it’s best to do the job correctly and send WM_SETICON messages directly to set both small and large icons.

As for where your icons are, link them to your executable as resources. I avoid image lists because I lose control of unprocessed .ico files, but maybe only I am picky. Feel free to use image lists if you want.

+5
source

Source: https://habr.com/ru/post/1496299/


All Articles