Solved

Keep a Form hidden on startup the program...

Posted on 1997-12-03
6
125 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
Highfive Gives IT Their Time Back

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!

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 85
Mydac connection data base issue 3 107
Newbie Thread Programming 1 118
creating threads in delphi 1 55
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 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

17 Experts available now in Live!

Get 1:1 Help Now