Add a status bar in dll-form. lazarus / 31-LCL ---------------------------------------------------------------------- lychee · 2019-09-17 16:16 I'm learning code form https://wiki.lazarus.freepascal.org/Form_in_DLL. I want add a status bar in dll-form. So I modify the TDLLDialog.Create constructor. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constructor TDLLDialog.Create(aOwner: TComponent);  var    BtnShowMessage: TButton;    StatusBar1: TStatusBar;  begin    inherited CreateNew(aOwner);     Caption := 'This form is in a DLL !!!';    Position := poWorkAreaCenter;    Width := 200;    Height := 100;     BtnShowMessage := TButton.Create(Self);    BtnShowMessage.Parent := Self;    BtnShowMessage.Caption := 'Show message';    BtnShowMessage.AutoSize := True;    BtnShowMessage.OnClick := @BtnShowMessageClick;    StatusBar1 := TStatusBar.Create(Self);    StatusBar1.Parent := Self;  end;            It’s compiled ok, but run it ,I got  Failed to create win32 control, error: 1406, Why? What’s mistake did  I made? ---------------------------------------------------------------------- winni · 2019-09-17 16:40 Hi! Error 1406 means that for whatever reasons Windows fails to write into the registry. I would say: disable your anti virus software and try again. Which Windows version? In very old versions (<= 2000) it could also be, that the registry reached the maximum size. Winni ---------------------------------------------------------------------- lychee · 2019-09-17 17:00 Quote from: winni on September 17, 2019, 06:40:22 pmHi! Error 1406 means that for whatever reasons Windows fails to write into the registry. I would say: disable your anti virus software and try again. Which Windows version? In very old versions (<= 2000) it could also be, that the registry reached the maximum size. Winni Windows XP without  anti-virus. FYI https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms- erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d https://docs.microsoft.com/en-us/windows/win32/debug/system-error- codes--1300-1699- 0x0000057E ERROR_TLW_WITH_WSCHILD Cannot create a top-level child window. ---------------------------------------------------------------------- winni · 2019-09-17 18:46 Hu!? https://support.microsoft.com/de-de/help/300451/windows-installer- error-1406-occurs-when-installing-software And now, Microsoft?! What is right? ---------------------------------------------------------------------- jamie · 2019-09-17 22:35 My Windows Help file states this.. 1406L = "Error_TLW_WITH_WSCHILD" Which means "Tool Window as a Child Window"  normally tool windows are not childs.  Also, I don't know if that is actually a true dialog window or a TFORM ?  if it's a TFORM style then you need to create using CreateNew, Not Create otherwise it will be looking for resource to load in. ---------------------------------------------------------------------- lychee · 2019-09-18 03:13 Quote from: jamie on September 18, 2019, 12:35:35 amMy Windows Help file states this.. 1406L = "Error_TLW_WITH_WSCHILD" Which means "Tool Window as a Child Window"  normally tool windows are not childs.  Also, I don't know if that is actually a true dialog window or a TFORM ?  if it's a TFORM style then you need to create using CreateNew, Not Create otherwise it will be looking for resource to load in. Actually, the code from https://wiki.freepascal.org/Form_in_DLL works fine. I just add a status bar in TDLLDialog. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i StatusBar1 := TStatusBar.Create(Self);StatusBar1.Parent := Self; When you click 'Show modal form' button, You'll got 'Failed to create win32 control, error: 1406'. ---------------------------------------------------------------------- Cyrax · 2019-09-18 06:17 Using LCL from DLL is not supported. Maybe upcoming dynamic package support at FPC will change that. ---------------------------------------------------------------------- zgabrovski · 2020-04-15 10:55 Confirmation: The bug is related with a StatusBar control under Windows. Just replaced with standard panel and works fine. LCL works fine in DLL. ---------------------------------------------------------------------- zgabrovski · 2020-04-15 19:09 So here is the solution, if you want to have a StatusBar working in your LCL form in DLL. The problem becomes from unassigned application handle in DLL library code. Lazarus LCL tries to creates a form with WS_CHILD style, which raises an error. Here is the similar problem described (it is for VC++, but same problem) https://stackoverflow.com/questions/39423719/cwindowimpl-create- returns-error-code-1406 The fix is already applied. https://bugs.freepascal.org/view.php?id=37100 Cheers, Zdravko