Thank you jeremiah for your explanations. I appreciate that you are trying to help me and your knowledge. But in this case, from what I have tested, you are wrong in 2 points:
1) Calling Application.Run():
I added 4 writeln commands to your code in project1.lpr from reply #5 to have:
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
writeln('AAA');
Application.CreateForm(TForm1, Form1);
writeln('BBB');
Application.ShowMainForm:=false;
writeln('CCC');
Application.Run;
writeln('DDD');
end.
and started your code. This way you can see, that Application.Run() is only executed at the moment,
after the program had already finished. In my eyes this makes no sense. I totally agree with you, that Application.Run() *should* be called in a way, that it can do it's important job. But this way this is
not possible. Please try it. Thanks.
2) Loading an INI-file:
I changed the project file of my real project to the code some lines above (that means I enabled Application.Run) and modified the end of procedure TForm1.FormCreate() to display some INI-variables. They were empty. (In procedure TForm1.FormActivate() they were filled). This test proves, that the INI-file is loaded
after TForm1.FormCreate() has completed and can
not be used inside. Please try it. Thanks.
To avoid misunderstandings:
I am not interested to find some workarounds / detours to handle an INI-file somehow nevertheless. I have multiple projects where I want to use feature 'Application.ShowMainForm:=false' but if this feature would mean (what I can't believe), that e.g. the standard use of an INI-file via the Main Form is not longer possible, than this would be the wrong feature for me. So please don't go in that direction.
I am convinced that we still don't use 'Application.ShowMainForm:=false' in the intended way, because then
- Application.Run() is made useless
- the standard use of an INI-file via the Main Form is not longer possible.
The intention of this Topic is to find someone who knows, what is the correct (intended) way to use feature 'Application.ShowMainForm:=false'? Thanks.