Solved

Keep a Form hidden on startup the program...

Posted on 1997-12-03
6
130 Views
Last Modified: 2010-04-04
I'm making a program that uses a sheared Memory code. and the other programs that it loads use the ParmStr(#) to send the program a spical command.  The probleam....  with one command I'm using is to get the program send back a message to the Main program, but I don't want the form to show during the the message be sent.  How can I get around this.  I've tryed to turn the main Form1.Visable to false with little effect.  thanks for any help
(Willing to give the 200 points for example)  
0
Comment
Question by:PPaul
[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
6 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1352828
I can't quite understand exactly what you want, but to hide the main form do do the following in your project code:

    Application.ShowMainForm := False;

Put this just before the line:
    Application.Run;

JB
0
 
LVL 3

Expert Comment

by:williams2
ID: 1352829
Ok! ..I'm not really sure of what you are looking for, but to generate an application or command you just choose Project->Options in the menubar. Then select Linker->Generate console application. Afterwards you choose remove Unit1 (Form1 goes with it). Try and run the project now (It stops immidiatly) (Delphi 2.0 got a bug using this one in win95, therefore I do it this way!)
now you include a new unit (not form).

The Program source looks like:
********************
Program Project1;

uses
  Forms, //You can remove this one.
  Unit1 in 'Unit1.pas';

{$R *.RES}

begin
  Application.Initialize;
  Application.Run;
end.
********************

The Unit should look like:
********************
unit Unit1;

interface

implementation
begin
  write('Hi dude!');
  readln; //This is for the console only to view output before
          //Closing prompt.
end.
********************



0
 
LVL 1

Expert Comment

by:zac
ID: 1352830
If you want the form always to show minimsed, the simplest way to do it is in the FormCreate event thus:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowWindow(Handle, SW_MINIMIZE);
end;

This will minimise the form on startup, however if you wish to find out whether the user requested minimsed startup etc then you have to use the following (32 bit only)

procedure TForm1.FormCreate(Sender: TObject);
var
  MyInfo: TStartUpInfo;
begin
  GetStartUpInfo(MyInfo);
  ShowWindow(Handle, MyInfo.wShowWindow);
end;

Hope it works for you!

Z
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:PPaul
ID: 1352831
To JimBob - This was the code I was looking for thanks.... but I can't give you the points for it... If you know a way that I can give you the points thatn tell me.... thanks

0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1352832
If you want my answer, you must reject the proposed answer from Williams2.  Then I will answer the question, and you can grade it.

Regards,
JB
0
 
LVL 4

Accepted Solution

by:
itamar earned 200 total points
ID: 1352833
Open your project Unit
Insert the following line before Application.Run:

Application.ShowMainForm := False;
Application.Run; // Keep

If you want to hide the app taskbar icon you can include a initialization clauses in the main form:

initialization
begin
   { To hide the application TASKBAR icon }
   ShowWindow( Application.Handle, SW_HIDE ); // Get it done NOW
   Application.ProcessMessages;
end;

IHTH
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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