Forms Delphi

Title: More than one Mainform
Question: I have an application that usually pops up with an editor as mainform. But when called with a parameter I must use another window.
Answer:
The trick is not to have 2 mainforms, but to hide the one you have, and show another form instead.
You must autocreate yoru mainform plus any additinal forms you may wish to show. In order to show another form than the mainform, use ShowMainForm := FALSE, as in this example:
uses
Forms,
main in 'main.pas' {frmMain},
...
...
drawcal in 'drawcal.pas' {frmDrawCal};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Calendar Wallpaper';
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmDrawCal, frmDrawCal);
if ParamCount = 1 then
begin
frmMain.Visible := FALSE; // Hide mainform
Application.ShowMainForm := FALSE; // Do not show mainform
frmDrawCal.ShowModal; // Show another form instead
end;
Application.Run;
end.
This example shows that if the program is called with 1 parameter, the mainform (frmMain) is hidden and my other form (frmdrawCal) is shown instead.
Please note that both forms are autocreated.