Link to home
Start Free TrialLog in
Avatar of dapple
dappleFlag for Japan

asked on

Hide Form StartUp

I want to hide the mainform when the program starts, i tried hide in create event and activate event onshow but does not work. Delphi 1 code only please
De
Avatar of BoRiS
BoRiS

dapple

View your program source, in the program source type this

Application.ShowMainform := False;

in your code put this to hide it from the taskbar...

ShowWindow(application.handle, SW_HIDE);

Later
BoRiS

Hi,
When do you want to show it and what would trigger it?

One way of doing it is to remove the form creation in the project source and replacing it with:

  MainForm := TMainForm.Create( Application );
  ...
  MainForm.Show; // or ShowModal

I think I remember that D1 had a problem with these things and that the solution was to put the above code in a procedure and
call it like this:

  procedure InstantiateMainForm;
  begin
    MainForm := TMainForm.Create( Application );
  end;

  begin
     Application.Initialize;
     InstantiateMainForm; // try without this and D1 doesn't like it?!
     // do whatever code you need here to show your window
     Application.Run;
   end.  

Haven't use D1 in a long time, so don't get angry if this doesn't work.

/// John
hi, dapple.

start a new project and add a timer.
enter the following:

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Interval := 1000;
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  ShowWindow(Handle, SW_SHOW);
  Timer1.Enabled := False;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ShowWindow(Handle, SW_HIDE);
end;

this should do it.

regards,

Black Death.
hi, dapple.

start a new project and add a timer.
enter the following:

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Interval := 1000;
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  ShowWindow(Handle, SW_SHOW);
  Timer1.Enabled := False;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ShowWindow(Handle, SW_HIDE);
end;

this should do it.

regards,

Black Death.
oh, ****. boris:

i started this before you posted yours and posted mine after you posted yours, so i didn't know you answered the same. sorry.

only point is: application.showmainform is not available in delphi 1.

regs,

Blach Death.
haha, i've found something funny:

procedure TForm1.FormCreate(Sender: TObject);
begin
  Left := Screen.Width;
end;

this one wouldn't flicker (which could happen sometimes with the former one - not necessarily, but *could*)

Black Death;
dapple

that should be you project source not your program source sorry...

Application.showMainForm := false; //must be put in before Application.Run;

Later
BoRiS
BoRiS?

did you read my comment on application.showmainform?
(none-delphi 1-code)

cheerio,

Black Death.
dapple, sorry for my previous comment (in other thread) didn't know you needed a Delphi 1 Source code. Still help needed?
blackdeath

no i didin't until now sorry...

thats why I gave him both, for the project source and the program source...

figured that he would load the mainform of the screen...

Form1.Left := -5000 or something along those lines...

anyway
Later
BoRiS
Avatar of dapple

ASKER

sorry Boris i have to give the points to blackdeath he answered correctly first, thanks everyone for your time.Yeah blackdeath that is clever, it works well answer the qusetion and i will grade you. One other quick question how can i turn the hidden properties of a file on in D1, if you answer i will increase the points for this question cya
dee
Note:
Make sure that you only do the OnActivate part once, otherwise the form will disappear everytime it is activated...!

  procedure TForm1.FormActivate(Sender: TObject);
  begin
    if ( Tag = 0 ) then // or something like this...
    begin
      ShowWindow(Handle, SW_HIDE);
      Tag := 1;
    end;
  end;

/// John
Hi,
Not my question, but I'll answer anyway:

  Filename := 'dat.dat';

  // remove hidden...
  FileSetAttr( Filename, FileGetAttr( Filename ) and ( not faHidden ) ); // mask out hidden

  // set hidden...
  FileSetAttr( Filename, FileGetAttr( Filename ) or faHidden ); // mask out hidden

/// John
dapple

no problem, just remember the code I gave you when you upgrade to delphi 2,3,4

Later
BoRiS
hey, dapple.

please do me a favour - give the initial 20 points to BoRiS and post a new question worth the amount you intended to increase to john's for his answer to the second question.
i don't like points.

thanx & bye,

Black Death.
No need for that.

/// John
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
dapple

I agree with black death if he does not want to answer, let linda delete the queston as you have your answer...

But I still think black death sould just answer the question with a "here you go" and all's well

Come on black death you can do it, i know you can...  8-)

as for the other question post it in to erajoj...

Later
BoRiS
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
ASKER CERTIFIED SOLUTION
Avatar of BlackDeath
BlackDeath

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
i wonder why my comment sometimes appear twice...?

Happy trigger finger?! :)

/// John
this isn't monday morning, you know...
btw, i'm. so. f... sluggish. my girlfriend. mostly. thinks i'm already. *yawn*. dead... *sigh*.
nice conversation going on...
à votre chanté, mon ami!
temple and arch, i'm so done with today...
think i'm gonna.
bye,
go.
Good Black Night Death.
Avatar of dapple

ASKER

thanks for your help
you're welcome. have a nice day,
Black Death.