Solved

Keep a Form hidden on startup the program...

Posted on 1997-12-03
6
128 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
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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