Anna Blanca 1 Posted yesterday at 02:32 AM Hello. I'm trying add Form in my DLL, and i hide it with next constraction: procedure Start; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.ShowMainForm := False; Application.Run; end; exports Start; Earlier, in previous versions Delphi, my DLL worked normal, but exactly in 12-th Delphi version, all broked. When i launch my library through app, it's working normal, but when i launch through rundll32.exe - no one component on Form1 not working. What Embarcadero broked in this time and how fix it? P.S. I attach my project to this topic, you can open it and look all youselfe. Fucking DLL.zip Share this post Link to post
Remy Lebeau 1619 Posted yesterday at 04:46 AM (edited) Your Start() function is not compatible with rundll32. It's a wonder your code ever worked at all. You are invoking undefined behavior. Read: INFO: Windows Rundll and Rundll32 Interface Your Start() function MUST have the following signature in order for rundll32 to call it correctly: procedure Start(hwnd: HWND; hinst: HINSTANCE; lpszCmdLine: PAnsiChar; nCmdShow: Integer); stdcall; Edited yesterday at 04:52 AM by Remy Lebeau Share this post Link to post
Anna Blanca 1 Posted 12 hours ago (edited) 19 hours ago, Remy Lebeau said: Your Start() function is not compatible with rundll32. It's a wonder your code ever worked at all. You are invoking undefined behavior. Hm-m-m, earlier, in Delphi 11, all worked normal and my library launched by rundll32.exe normal. So, and what is HINSTANCE? When i use it in my code, IDE underlining it by red.... No one module in uses not help. Edited 12 hours ago by Anna Blanca Share this post Link to post
DelphiUdIT 248 Posted 5 hours ago 6 hours ago, Anna Blanca said: So, and what is HINSTANCE? When i use it in my code, IDE underlining it by red.... No one module in uses not help. HInstance is the instance (var) of the module, derived from System.pas (type HINST). Should be always defined and available 'cause it is used at loading time (look SysInit.pas) FYI, MainInstance in the HInstance of the MAIN APPLICATION (not the module like dll, library, ...). Share this post Link to post