0

I have a tray application that monitors Windows services. Depending on the status of the Windows Service, I change the application icon to either a green, orange or red LED.

My default application icon is the red LED (Project -> Options -> Application -> Icons).

All the icons change except the icon of the main form, that does not change. The following icons does change:

  1. Tray icon enter image description here
  2. Taskbar icon when maximized enter image description here
  3. Icons of all other forms enter image description here

What do I need to do to get the main form icon to change?

I have even explicitly change the frmMain.Icon but that also did not work.

My code is simple and looks like this:

    {set the application icon}
    if FAppStatus = Error then
      ImageList.GetIcon(2, Application.Icon)
    else
    if FAppStatus = Warning then
      ImageList.GetIcon(1, Application.Icon)
    else
      ImageList.GetIcon(0, Application.Icon);
    frmMain.Icon := Application.Icon;

I have tried different BorderStyles but that made no difference. I also played with Application.MainFormOnTaskbar without success.

Moderator: Please note that this question is not about the taskbar icon. The posts about the Taskbar icon did not resolve this issue.

Johan
  • 317
  • 3
  • 11
  • 1
    Please don't ask the same question multiple times. If you don't agree with the close resolution of your previous question, comment as such on that question, it can always be reopened. – Remy Lebeau Feb 18 '22 at 08:32
  • @RemyLebeau, I did edit my previous question and I did mentioned that the "solutions" that were suggested had nothing to do with my question - they were all about the task bar icon and NOT about the application icon. However, my question remained close. So, I logged the question again, and it got closed as a duplicate. What am I suppose to do? – Johan Feb 18 '22 at 10:44
  • Even when you first posted your question I tried to reproduce your issue but failed to do so. From your last image it seems that you have two forms opened. Is perhaps this second form opened as modal form? If it is then this might be preventing your main form from updating its icon until your second form is closed. – SilverWarior Feb 18 '22 at 11:17

0 Answers0