Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Keep a Form hidden on startup the program...

Posted on 1997-12-03
6
Medium Priority
?
132 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 800 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

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!

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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

715 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