Solved

Keep a Form hidden on startup the program...

Posted on 1997-12-03
6
131 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
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!

 

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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. 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

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…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

624 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