View Issue Details

IDProjectCategoryView StatusLast Update
0019321LazarusLCLpublic2012-03-16 11:03
ReporterEdin Assigned ToVincent Snijders  
Status resolvedResolutionfixed 
Product Version0.9.31 (SVN) 
Target Version1.2.0Fixed in Version0.9.31 (SVN) 
Summary0019321: bsDialog Form shows Icon
DescriptionForms with BorderStyle= bsDialog shows Icon, and not the custom one but the one from application/project.
Putting in a custom one doesn't work, but I don't think bsDialog Form should show an icon at all.

TagsNo tags attached.
Fixed in Revision36074
Attached Files


related to 0019439 resolvedVincent Snijders Updates needed For Win64 bit 


Paul Ishenin

2011-05-10 05:40

manager   ~0048169

Can't reproduce. Maybe something wrong in your project? Please attach a project for testing.

Paul Ishenin

2011-05-10 05:41

manager   ~0048170

Although I tested on win32 with fpc 2.5.1


2011-05-10 07:09

reporter   ~0048171

It's a 64bit bug.
I have some old compiles of the project done with 32bit lazarus that work.
64bit lazarus compiled app will show the icon in every new project.
And the application itself is also a 64bit one.

2011-05-10 14:16 (1,033,667 bytes)

2011-05-10 14:20


DialogTest .png (95,758 bytes)   
DialogTest .png (95,758 bytes)   


2011-05-10 14:21

reporter   ~0048192

Attached Example Files.


2011-05-15 16:55

reporter   ~0048310

Iv'e been doing a lot of research on this so I even created a non LCL gui application in 64bit Lazarus to test this.
I managed to create a bsDialog (as a second form) as its done in LCL with

but the Icon was still showing because
when I created its windowclass I had:
    hIcon := Windows.LoadIcon(0, IDI_APPLICATION).

    hIcon :=0 or
    hIcon := Windows.LoadIcon(0, nil);
fixed this and the icon was GONE!

So my conclusion is that LCL is setting the default APPLICATION icon somewhere in the definition of the window class for this type of form,
maybe in function TWin32WidgetSet.WinRegister.


2011-05-15 17:04

reporter   ~0048311

And, here's a hack for that:

uses Windows

procedure TForm2.FormActivate(Sender: TObject);
   SetClassLongPtr( Form2.WindowHandle, GCLP_HICON, 0);

This will fix it but it's a last resort solution,
something that should be handled while creating bsDialog window class.


2011-05-15 17:53

reporter   ~0048312

Hmmm...It's possible that SetIcon(0,0) fails because it's using
SetClassLong not SetClassLongPtr!

Yeah that must be it.
There's lot of these left in the code that need to be replaced.


2011-05-15 18:04

reporter   ~0048313

All these need to have SetClassLong replaced with SetClassLongPtr
so they won't fail on win 64bit:

lazarus_source_30650\lcl\interfaces\win32\ SetClassLong(FAppHandle, GCL_HICONSM, LONG(Small));
lazarus_source_30650\lcl\interfaces\win32\ SetClassLong(FAppHandle, GCL_HICON, LONG(Big));
lazarus_source_30650\lcl\interfaces\win32\win32wscalendar.pp:86: SetClassLong(Result, GCL_STYLE, GetClassLong(Result, GCL_STYLE) or CS_DBLCLKS);
lazarus_source_30650\lcl\interfaces\win32\win32wsforms.pp:624: SetClassLong(Wnd, GCL_HICONSM, LONG(Small));
lazarus_source_30650\lcl\interfaces\win32\win32wsforms.pp:627: SetClassLong(Wnd, GCL_HICON, LONG(Big));

and maybe those in WinCE files too...


2011-05-15 21:35

reporter   ~0048318

And SetClassLong isn't the only one that needs replacing.
Just in the post above i see GetClassLong that needs updating too.

Someone should go in and adjust all these calls *Long to new *LongPtr, and while there also check others that have been changed in 64bit windows.

As you probably know these new calls are compatible with both 32 and 64bit windows.

Vincent Snijders

2012-03-16 11:02

manager   ~0057705

Thanks for the hint on how to fix it.

Issue History

Date Modified Username Field Change
2011-05-10 05:19 Edin New Issue
2011-05-10 05:19 Edin Widgetset => Win32/Win64
2011-05-10 05:40 Paul Ishenin LazTarget => -
2011-05-10 05:40 Paul Ishenin Note Added: 0048169
2011-05-10 05:40 Paul Ishenin Status new => feedback
2011-05-10 05:41 Paul Ishenin Note Added: 0048170
2011-05-10 07:09 Edin Note Added: 0048171
2011-05-10 14:16 Edin File Added:
2011-05-10 14:20 Edin File Added: DialogTest .png
2011-05-10 14:21 Edin Note Added: 0048192
2011-05-15 16:55 Edin Note Added: 0048310
2011-05-15 17:04 Edin Note Added: 0048311
2011-05-15 17:53 Edin Note Added: 0048312
2011-05-15 18:04 Edin Note Added: 0048313
2011-05-15 21:35 Edin Note Added: 0048318
2012-03-13 11:41 Vincent Snijders LazTarget - => 1.2
2012-03-13 11:41 Vincent Snijders Status feedback => acknowledged
2012-03-13 11:41 Vincent Snijders Target Version => 1.2.0
2012-03-13 11:55 Vincent Snijders Relationship added related to 0019439
2012-03-16 11:02 Vincent Snijders Fixed in Revision => 36074
2012-03-16 11:02 Vincent Snijders Status acknowledged => resolved
2012-03-16 11:02 Vincent Snijders Fixed in Version => 0.9.31 (SVN)
2012-03-16 11:02 Vincent Snijders Resolution open => fixed
2012-03-16 11:02 Vincent Snijders Assigned To => Vincent Snijders
2012-03-16 11:02 Vincent Snijders Note Added: 0057705