Recent

Author Topic: Duplicated icon in the Windows Taskbar  (Read 1628 times)

dseligo

  • Hero Member
  • *****
  • Posts: 1671
Re: Duplicated icon in the Windows Taskbar
« Reply #15 on: February 16, 2026, 03:14:50 pm »
Did you try to right click the icon and click on 'Unpin from taskbar'?
Yes.  The same behaviour whether running from Lazarus or not, pinned or unpinned from the taskbar.

So, you don't have any icon and when you run your program Windows shows two icons?

Quote
there are two icons in the taskbar, one on top of the other.

What does this mean ('one on top of the other')? Can you post screenshot?

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #16 on: February 16, 2026, 05:30:23 pm »
So, you don't have any icon and when you run your program Windows shows two icons?
Yes.  Icon on the desktop, double-click, two icons in the taskbar.  Or icon pinned to taskbar, click and two instances again.

What does this mean ('one on top of the other')? Can you post screenshot?
I have to admit what I'm doing now!

Attached (I hope) is a photo (can't hover and screen capture!).   See that there are two icons and the two variants appear.  The one with the Star Trek symbol (was a Circle in discussion) and the Bell icon – Bell goes to the program, Star Trek does nothing.  Note that the HAL icon on its right is effectively the same program and is running one instance with one icon.  Somewhere along the line between HAL and LCARS, I set something that fouled this up.

n7800

  • Hero Member
  • *****
  • Posts: 639
  • Lazarus IDE contributor
    • GitLab profile
Re: Duplicated icon in the Windows Taskbar
« Reply #17 on: February 16, 2026, 08:43:26 pm »
It looks like this is due to the "MainFormOnTaskbar" property. What versions of Lazarus were these applications created in?

1. Open the main program file: Menu > Project > View Project Source
2. Add this line before the "Application.Initialize" line:
Code: Pascal  [Select][+][-]
  1. Application.MainFormOnTaskbar := True;

Did this help?

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #18 on: February 16, 2026, 09:15:59 pm »
It looks like this is due to the "MainFormOnTaskbar" property. What versions of Lazarus were these applications created in?

1. Open the main program file: Menu > Project > View Project Source
2. Add this line before the "Application.Initialize" line:
Code: Pascal  [Select][+][-]
  1. Application.MainFormOnTaskbar := True;

Did this help?
Bingo!  Thank you (and everyone) so much.
I do get 'Warning: Symbol "MainFormOnTaskbar" is not portable'.  Only one icon though, so great.
But why is this needed for this program, Version 2, and not for Version 1?

n7800

  • Hero Member
  • *****
  • Posts: 639
  • Lazarus IDE contributor
    • GitLab profile
Re: Duplicated icon in the Windows Taskbar
« Reply #19 on: February 16, 2026, 09:31:22 pm »
I do get 'Warning: Symbol "MainFormOnTaskbar" is not portable'.

Just ignore, this property is only needed for Windows, so it's declared platform-dependent.

For your information, this property was introduced so that main window caption and taskbar icon can have different text. But this is usually unnecessary, and it causes some strange bugs. Therefore, in the new version of Lazarus (4.0, IIRC), this line is added automatically in new projects (and has a directive to hide this warning).

But why is this needed for this program, Version 2, and not for Version 1?

Perhaps your two projects were created in different versions of the IDE?

Is this line missing in the previous version?

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #20 on: February 17, 2026, 01:51:24 pm »

But why is this needed for this program, Version 2, and not for Version 1?

Perhaps your two projects were created in different versions of the IDE?

Is this line missing in the previous version?
I've not updated my IDE for an age and the line is missing from Version 1.

n7800

  • Hero Member
  • *****
  • Posts: 639
  • Lazarus IDE contributor
    • GitLab profile
Re: Duplicated icon in the Windows Taskbar
« Reply #21 on: February 17, 2026, 06:11:54 pm »
Has the count or settings of forms changed between versions? Pay attention to their "ShowInTaskBar" property.

Also, check which ones are generated automatically. You can find this in the Project Options, "Forms" category (or simply open the main program file and look for the "Application.CreateForm" line).

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #22 on: February 18, 2026, 02:43:42 pm »
Has the count or settings of forms changed between versions? Pay attention to their "ShowInTaskBar" property.

Also, check which ones are generated automatically. You can find this in the Project Options, "Forms" category (or simply open the main program file and look for the "Application.CreateForm" line).
Project Options looked the same (except for Version 1 being two forms and the '  Application.MainFormOnTaskbar := True;' line).

Version 1 had ShowInTaskBar set to stDefault, whereas Version 2 had stAlways.  I had a play and setting it to stDefault removed the double icon issue.  However, I still needed to put 'Application.MainFormOnTaskbar := True;' back in to make it minimise and maximise properly.

 

TinyPortal © 2005-2018