How do I hide the main form on start?

Based on a command line param I want to be able to hide the main form before it shows itself on start. How can this be done? I've tried to do frmMain.Hide in OnCreate and it doesn't seem to work.

Thanks
ripcordAsked:
Who is Participating?
 
MatveyConnect With a Mentor Commented:
Again? :) I'm blushing...

Thanks my friends friends, I really receive lots of gifts for the Hebrew new year! BTW greetings to all of you!
0
 
erajojCommented:
Hi,
In Delphi 3+, just do this:
  Application.ShowMainForm := False;

/// John

0
 
MatveyCommented:
-Also, based on command line parameters, you could add a line to the DPR file:

Application.... ( mainform, ... );
if paramstr( N ) = '...' then mainform.hide;
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
MatveyCommented:
-Also, based on command line parameters, you could add a line to the DPR file:

Application.... ( mainform, ... );
if paramstr( N ) = '...' then mainform.hide;
0
 
erajojCommented:
Happy trigger finger?

/// John
0
 
MatveyCommented:
Heh, more coffee should help :-)
0
 
sakyaCommented:
Hello.

This is a sample.

----------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
begin
     Application.ShowMainForm := False;

     
     ShowMessage('Hello');// <-you write your procedure here


     Form1.Show;
end;
---------------------------------------

Application.ShowMainForm is written before Application.Run.
So, you can write Application.ShowMainForm in the OnCreate.

And when you want to display  the Main Form, use 'Show'.

sakya
0
 
ripcordAuthor Commented:
thanks for the help, someone answer the question for credit. All your answers worked.
0
 
erajojCommented:
Since it is election day here in Sweden and since Matvey has posted the majority of the comments, he should have the credit, all in the spirit of democracy.
Matvey, don't be shy!

/// John
0
 
sakyaCommented:
Hello.

I agree with erajoj.

sakya
 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.