?
Solved

Hide Form StartUp

Posted on 1998-08-25
28
Medium Priority
?
508 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:dapple
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 5
  • 5
  • +2
28 Comments
 
LVL 4

Expert Comment

by:BoRiS
ID: 1337772
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

0
 
LVL 4

Expert Comment

by:erajoj
ID: 1337773
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
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337774
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337775
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.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337776
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.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337777
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;
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1337778
dapple

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

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

Later
BoRiS
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337779
BoRiS?

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

cheerio,

Black Death.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1337780
dapple, sorry for my previous comment (in other thread) didn't know you needed a Delphi 1 Source code. Still help needed?
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1337781
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
0
 
LVL 1

Author Comment

by:dapple
ID: 1337782
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
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1337783
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
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1337784
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
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1337785
dapple

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

Later
BoRiS
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337786
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.
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1337787
No need for that.

/// John
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337788
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1337789
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
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337790
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
0
 
LVL 1

Accepted Solution

by:
BlackDeath earned 80 total points
ID: 1337791
here you go
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337792
i wonder why my comment sometimes appear twice...?

0
 
LVL 4

Expert Comment

by:erajoj
ID: 1337793
Happy trigger finger?! :)

/// John
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337794
this isn't monday morning, you know...
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337795
btw, i'm. so. f... sluggish. my girlfriend. mostly. thinks i'm already. *yawn*. dead... *sigh*.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1337796
nice conversation going on...
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337797
à votre chanté, mon ami!
temple and arch, i'm so done with today...
think i'm gonna.
bye,
go.
Good Black Night Death.
0
 
LVL 1

Author Comment

by:dapple
ID: 1337798
thanks for your help
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1337799
you're welcome. have a nice day,
Black Death.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question