Solved

Hide Form StartUp

Posted on 1998-08-25
28
499 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
  • 14
  • 5
  • 5
  • +2
28 Comments
 
LVL 4

Expert Comment

by:BoRiS
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
BoRiS?

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

cheerio,

Black Death.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
dapple

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

Later
BoRiS
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:BlackDeath
Comment Utility
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
Comment Utility
No need for that.

/// John
0
 
LVL 1

Expert Comment

by:BlackDeath
Comment Utility
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
0
 
LVL 4

Expert Comment

by:BoRiS
Comment Utility
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
Comment Utility
then let linda delete'em.

have a nice day, guys.

til later,

Black Death.
0
 
LVL 1

Accepted Solution

by:
BlackDeath earned 20 total points
Comment Utility
here you go
0
 
LVL 1

Expert Comment

by:BlackDeath
Comment Utility
i wonder why my comment sometimes appear twice...?

0
 
LVL 4

Expert Comment

by:erajoj
Comment Utility
Happy trigger finger?! :)

/// John
0
 
LVL 1

Expert Comment

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

Expert Comment

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

Expert Comment

by:ZifNab
Comment Utility
nice conversation going on...
0
 
LVL 1

Expert Comment

by:BlackDeath
Comment Utility
à 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
Comment Utility
thanks for your help
0
 
LVL 1

Expert Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now