View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0019321||Lazarus||LCL||public||2011-05-10 05:19||2012-03-16 11:03|
|Reporter||Edin||Assigned To||Vincent Snijders|
|Product Version||0.9.31 (SVN)|
|Target Version||1.2.0||Fixed in Version||0.9.31 (SVN)|
|Summary||0019321: bsDialog Form shows Icon|
|Description||Forms 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.
|Tags||No tags attached.|
|Fixed in Revision||36074|
||Can't reproduce. Maybe something wrong in your project? Please attach a project for testing.|
||Although I tested on win32 with fpc 2.5.1|
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.
DialogTest.zip (1,033,667 bytes)
||Attached Example Files.|
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
WS_EX_DLGMODALFRAME or WS_EX_WINDOWEDGE,
WS_POPUP or WS_BORDER or WS_CAPTION or WS_SYSMENU,
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.
And, here's a hack for that:
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.
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.
All these need to have SetClassLong replaced with SetClassLongPtr
so they won't fail on win 64bit:
lazarus_source_30650\lcl\interfaces\win32\win32object.inc:450: SetClassLong(FAppHandle, GCL_HICONSM, LONG(Small));
lazarus_source_30650\lcl\interfaces\win32\win32object.inc:453: 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...
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.
||Thanks for the hint on how to fix it.|
|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: DialogTest.zip|
|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|