Can not create StatusBar control under Win32 LCL Dll application
Original Reporter info from Mantis: zgabrovski
-
Reporter name: Zdravko Gabrovski
Original Reporter info from Mantis: zgabrovski
- Reporter name: Zdravko Gabrovski
Description:
The problem was described here:
https://forum.lazarus.freepascal.org/index.php?topic=46780.0
and comes from Application.Handle = 0 in LCL Dll applications in InitializePreferredStatusBarHeight procedure in Win32WSComCtrls.pp
The proposed fix check if Application handle is = 0 and IsLibrary = True ,to take current form handle instead of Application.Handle.
In that case, CreateWindowExW will not fail with 1406 error.
Parent := TWin32WidgetSet(WidgetSet).AppHandle;
if ( Parent=0 ) and IsLibrary and Assigned( Screen.ActiveForm ) then <----- The fix
Parent := Screen.ActiveForm.Handle; <-----
PreferredSizeStatusBar := CreateWindowExW(0, STATUSCLASSNAMEW,
nil, Flags,
0, 0, 0, 0, Parent, 0, HInstance, nil);
Steps to reproduce:
as desribed here https://forum.lazarus.freepascal.org/index.php?topic=46780.0
and here https://bugs.freepascal.org/view.php?id=37079
Mantis conversion info:
- Mantis ID: 37100
- OS: Windows
- OS Build: all
- Build: trunk
- Platform: Windows
- Fixed in revision: r63288 (#e2fdf3e8)