Link to home
Start Free TrialLog in
Avatar of alona041797
alona041797

asked on

Start HIDDEN

I want a delphi 2 app (with forms) to start with its main form hidden, and not show any icon in the taskbar of the task list. Also, I DO NOT want it to appear for a second and just then diapper, I want it to never appear in the first place.

More points may be granted if needed.
Avatar of mosi
mosi
Flag of Netherlands image

Did you try to put this in your projectfile
 Showwindow(application.handle,SW_HIDE)
just before application.run ?

 
Avatar of alona041797
alona041797

ASKER

That doesn't work! The project starts a taskbar icon, hides the taskbar icon and then shows the form normally!!
ASKER CERTIFIED SOLUTION
Avatar of mirek071497
mirek071497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi there alona,

Part one of your question is easy without dicking around and setting its location off screen.  Simple go to the DPR file and do the following:

PROGRAM HideForm;

USES
   Forms, OtherStuff;

{$R *.RES}

BEGIN
   Application.Initialize;
   Application.ShowMainForm := FALSE;  <-- Prevents form showing
   Application.CreateForm( TFormType, FormInstance );
   Application.Run;
END.

This is exactly what the ShowMainForm property was meant for.

Now part two of your question.  Do the following:

CONSTRUCTOR TForm1.Create( AOwner: TComponent );
BEGIN
   Inherited Create( AOwner );      {Create the object instance}

   ShowWindowAsync( (Owner AS TApplication).Handle, SW_HIDE );
END;

I hope this helps you out.
Cheers,
Ian C.
I need to check both of your answers and grade the best one... wait a day or two...
we are waiting more than 3 weeks !
... oops ... I'll check your answers ... wait ...