Recent

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

w click

  • Full Member
  • ***
  • Posts: 205
Duplicated icon in the Windows Taskbar
« on: February 13, 2026, 05:47:49 pm »
I had a program that sat in the Windows 10 taskbar, click it and it runs.  The icon is still there.  You can click the icon to minimise and restore it, exactly as you'd want and expect.

I wrote another version of the same program, but now when it runs, there are two icons in the taskbar, one on top of the other.  When I hover over them, I get two versions of the program appear as floating options – the right brings the program up, the left does nothing.  I did change form1's borderstyle to bsnone, but that's not it, as it doesn't fix it when I change it back.  I mention it because that's the sort of thing I've been adjusting in this version.  I've messed something up.

Anyone any idea how to get rid of this duplication?

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #1 on: February 15, 2026, 12:39:48 pm »
Anyone?

jamie

  • Hero Member
  • *****
  • Posts: 7586
Re: Duplicated icon in the Windows Taskbar
« Reply #2 on: February 15, 2026, 01:15:23 pm »
Do you have that app setup in Autorun when the OS starts? If so, remove the old one.

also, you may want to have windows rebuild its icon cache, you can find info on that online.

Sounds more like a windows problem to me.

jamie
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1641
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Duplicated icon in the Windows Taskbar
« Reply #3 on: February 15, 2026, 01:24:37 pm »
I your app creates five windows, you will have 5 items in the task bar.
If you use the systray - if you run and stop a program ten times,you will have ten icons, but they disapper when clicked or focused.
You wrote Windows 10, but maybe it is worth mentioning, that the taskbar of Windows 11 is not ready for usage yet, I have mo idea if they intend to fix it.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #4 on: February 15, 2026, 02:57:10 pm »
Jamie: I do have the app set to run on startup.  I don't think it's an icon cache issue and rebuilding it looks scary.  And, yes, it is a Windows problem, I'm sure, but why does one program work and the other doesn't?

CM630: The App creates one window.  It creates two versions observable in Task Manager, even when I remove the shortcut from the Systray.  I copied-and-pasted from a program that doesn't behave like this to create the new one.  I run and stop ten times, and one doesn't have duplicates, the other always has two.  And I'm avoiding Windows 11 and considering Linux Mint.

Hmm, I changed form1's icon to a Bell, the project options icon to a Circle, then I get two incidents of the program in the Systray, both looking like the old icon!!!  When I hover over it, the two incidents have left, a Circle, and right, a BellCircle does nothing, Bell is the program.

The program's form1 does have the bordericons to false and the borderstyle to bsNone.

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #5 on: February 15, 2026, 02:58:47 pm »
I should add that this behaviour is the same when running from the Lazarus IDE or not.

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #6 on: February 15, 2026, 03:51:10 pm »
And rebooting changes the old icon in the SysTray to the Circle, which is as you'd expect.

jamie

  • Hero Member
  • *****
  • Posts: 7586
Re: Duplicated icon in the Windows Taskbar
« Reply #7 on: February 15, 2026, 04:15:59 pm »
And what does the Task Manager report as number of processes running form that one EXE ?

Jamie
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1641
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Duplicated icon in the Windows Taskbar
« Reply #8 on: February 15, 2026, 04:28:20 pm »
Did you try to put exit; on the very first line of the .Create of your main form (also in .OnLoaded if not empty)?
If the second icon disappears, that you could move the exit; down and down again, until the second icon shows again.

...
CM630: The App creates one window.  It creates two versions observable in Task Manager,
...
Usually there is one parent instance in the task manager and one child. Maybe posting some shortcuts will not hurt.

... And I'm avoiding Windows 11 and considering Linux Mint....
I believe Windows 10 is far from dead. I seriously doubt that the transition from Win 10 to Win 11 will be so smooth and easy as from Win 7 to Win 10. Also, Linux does handle properly case sensitivity in *fat and ntfs, there are some steps towards case folding in ext4, not sure if there will be some result. But this is a different issue, I just meant "Don't panic!"
« Last Edit: February 15, 2026, 04:42:59 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #9 on: February 16, 2026, 11:36:23 am »
And what does the Task Manager report as number of processes running form that one EXE ?

Jamie
There are two.  They have different icons, the circle and bell.

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #10 on: February 16, 2026, 11:48:26 am »
Did you try to put exit; on the very first line of the .Create of your main form (also in .OnLoaded if not empty)?
If the second icon disappears, that you could move the exit; down and down again, until the second icon shows again.
Not a trick I know, but I put 'exit;' as the first line of form1.formcreate;  This makes two processes, both with the circle icon.  I'm guessing one is reset at the end of the create.  I then get all sorts of exceptions and breaks due to string processing.

Usually there is one parent instance in the task manager and one child. Maybe posting some shortcuts will not hurt.
So, the two processes are normal?  What do you mean by posting shortcuts?

I believe Windows 10 is far from dead. I seriously doubt that the transition from Win 10 to Win 11 will be so smooth and easy as from Win 7 to Win 10. Also, Linux does handle properly case sensitivity in *fat and ntfs, there are some steps towards case folding in ext4, not sure if there will be some result. But this is a different issue, I just meant "Don't panic!"
I shall be sticking to Windows 10 for a good long while.  Linux doesn't have autohotkey, so I'm going to have issues with my keyboard.  I know where my towel is, so I won't be panicing :–)

CM630

  • Hero Member
  • *****
  • Posts: 1641
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Duplicated icon in the Windows Taskbar
« Reply #11 on: February 16, 2026, 01:11:53 pm »
Next try: do you happen to have more than one autocreated forms?
(Main Menu — Project — Project Options...)
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #12 on: February 16, 2026, 01:39:53 pm »
Next try: do you happen to have more than one autocreated forms?
(Main Menu — Project — Project Options...)
The above is exactly what I have with a single Form1 in the Auto-create forms list.

dseligo

  • Hero Member
  • *****
  • Posts: 1671
Re: Duplicated icon in the Windows Taskbar
« Reply #13 on: February 16, 2026, 01:52:05 pm »
I had a program that sat in the Windows 10 taskbar, click it and it runs.  The icon is still there.  You can click the icon to minimise and restore it, exactly as you'd want and expect.

I wrote another version of the same program, but now when it runs, there are two icons in the taskbar, one on top of the other.  When I hover over them, I get two versions of the program appear as floating options – the right brings the program up, the left does nothing.  I did change form1's borderstyle to bsnone, but that's not it, as it doesn't fix it when I change it back.  I mention it because that's the sort of thing I've been adjusting in this version.  I've messed something up.

Anyone any idea how to get rid of this duplication?

Did you try to right click the icon and click on 'Unpin from taskbar'?

w click

  • Full Member
  • ***
  • Posts: 205
Re: Duplicated icon in the Windows Taskbar
« Reply #14 on: February 16, 2026, 02:57:35 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.

 

TinyPortal © 2005-2018