I have good news: the problem is solved!
Just to be clear, are these 3 check options with the "Application.MainFormOnTaskBar" property enabled or disabled? I don't know this code very well, but if I remember correctly, they can interact, so it's worth checking all (6) combinations.
I tested the 3 options for 'ShowInTaskBar'
without changing Application.MainFormOnTaskBar at this time.
Meanwhile I tested 'FD.ShowInTaskBar:=stNever' more detailed in both programs and also on Win10 and it does exactly what I wanted.
Question:Still I'm surprised that '
stNever'
enables the Taskbar entry... Does someone know why?
procedure TForm1.FormCreate(Sender: TObject);
begin
Top := -1000;
end;
This works too! I had thought, that such "illegal" values would be "corrected" internally e.g. to zero, but I was wrong, it works (Win7 + Win10).
And at last I found a 3rd option to solve the problem: I had written, that in 1 program the Main-Form is hidden via 'Visible:=false' in FormShow() and that there a procedure of a common Unit is called, which then acts as the "whole program". Now I found out, that this 'Visible:=false' - which causes the problem - is not neccessary at all, because at this time - the common procedure is called inside of FormShow() - the Main-Form is anyway not yet displayed (which I was not so aware clearly, when I had added the 'Visible:=false').
So FormShow() of the Main-Form now looks like:
procedure TForm1.FormShow(Sender: TObject);
begin
// Visible:=false; {causes problems and is NOT neccessary}
PictureViewer(mode,filespec,true); {acts as the "whole program"}
Visible:=false; {prevents some flicker at program end}
Close;
end;
I can use this solution only in 1 program, because the other one uses the INI-file of the Main-Form, which has not yet loaded in FormShow(), so in this 2nd program my "procedure in a common unit" is called later inside of FormActivate().
All tests done with Lzarus 3.6.0 / FPC 3.2.2.
Thanks a lot to n7800 and LV for your great solutions.