View Issue Details

IDProjectCategoryView StatusLast Update
0018484LazarusWidgetsetpublic2020-12-01 12:11
Reportercobines Assigned To 
Status acknowledgedResolutionopen 
PlatformWin32OSWindows XP 
Product Version0.9.31 (SVN) 
Summary0018484: Taskbar button icon sometimes disappears
DescriptionWhen a form uses a specific icon set via Icon property it sets the icon for the window with WM_SETICON as well as for the window class with SetClassLong(.., GCL_HICON..) in TWin32WSCustomForm.SetIcon. When the form is destroyed it destroys the handles to the icons but they are still assigned for the window class. This causes the icon not to be displayed for every other form unless again a correct handle is assigned via SetClassLong. Windows probably first wants to display class icon and only then looks at window icon (not confirmed, only found this empirically).

I don't think setting icon for window class is needed or at least set it to Application.Icon and don't change when a form gets an icon assigned.
Steps To Reproduce1. Run attached project.
2. Click "Show icons handles info", which displays info for Form1. Note that window icon is the same as class icon.
3. Click "Show Form2".
4. Click "Show icons handles info". Class icon handle has changed but is valid.
5. Close Form2.
6. Click "Show icons handles info". Class icon is now an invalid handle.
7. Click "Hide/Show itself". Form1 now has no icon on the taskbar button.
8. Click "Set class icon to 0".
9. Click "Hide/Show itself". The icon for Form1 is back.
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0018480 resolvedOndrej Pokorny Main form icon dissappears from Alt-Tab task list when form with ShowInTaskBar=stAlways active 


2011-01-13 05:48 (67,492 bytes)

Juha Manninen

2017-10-22 14:05

developer   ~0103677

Is this still a valid issue?

Juha Manninen

2020-12-01 12:11

developer   ~0127294

I tested on Windows 10. I can reproduce steps 1 - 6. Class icon handle is reported to be invalid. However the taskbar icon is always there. I guess Windows 10 caches it somehow.
Anyway this still looks like a valid issue.

Issue History

Date Modified Username Field Change
2011-01-13 05:48 cobines New Issue
2011-01-13 05:48 cobines File Added:
2011-01-13 05:48 cobines Widgetset => Win32/Win64
2011-02-07 20:39 Vincent Snijders LazTarget => -
2011-02-07 20:39 Vincent Snijders Status new => acknowledged
2012-10-02 00:33 Juha Manninen Relationship added related to 0018480
2017-10-22 14:05 Juha Manninen Note Added: 0103677
2020-12-01 12:11 Juha Manninen Note Added: 0127294