?
Solved

Hidding Form

Posted on 2004-04-24
10
Medium Priority
?
320 Views
Last Modified: 2010-04-05
Hi experts,

Ihave a problem hidding my form. If I set the form's visible property on the object inspector to false, when i run the program, i still can see the form. I also tried to set the form's visible property to false in the FormCreate procedure, but it doesn't work either. However, it works if i hide the form from the FormClose procedure and set Action to caNone.

Hope u can help me.

Thanks.

PS: i am using delphi4 and windows XP
0
Comment
Question by:StTwister
[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
10 Comments
 
LVL 3

Expert Comment

by:Kunfufaresi
ID: 10906809
Hello,

there arse some ways you can use
1) From Project menu choose Options and remove auto-create of form2

2) if you want to hide main form then you could use
Application.Minimize
0
 
LVL 2

Author Comment

by:StTwister
ID: 10906858
removing the auto-create doesn't hide the form, it simply doesn't create it, so i can't actually use that form.

Application.Minimize only minimizes the form, it doesn't hide it.
0
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 10907025
you can use

SendMessage(Form1.handle, WM_SYSCOMMAND, SW_HIDE);

I think that is the correct function and right parameters. I am not on a windows machine at the minute, so I'll check to see if the params are correct then ill post another reply.

hopefully though, the above is the correct params
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:StTwister
ID: 10907138
The procedure has one missing parameter, but it still doesn't matter, as i already tried with ShowWindow(Form1.Handle, SW_Hide), which does exactly the same thing. I also noticed that i can hide the form from any other procedure except FormCreate. For example i can hide it if i push a button or with a timer, but it doesn't respond in the FormCreate procedure.

Thanks.
0
 
LVL 3

Expert Comment

by:Kunfufaresi
ID: 10907204
Hello,

in formCreate the form is not yet created but in the process of being created so you will get a runtime error obviously. I remember using timer too. however if you put  form1.hide; in onPaint event of the form it will get hidden just after creation.

procedure TForm1.FormPaint(Sender: TObject);
begin
 form1.hide;
end;

hopefully this helps
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10907342
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure OnCreateForm(var Msg : TMessage); message WM_SHOWWINDOW;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

{ TForm1 }

procedure TForm1.OnCreateForm(var Msg: TMessage);
begin
  // here the form is shown
  if Self <> Application.MainForm then
    // this is not the main form and we can hide it
    Self.Hide;
end;

end.
0
 
LVL 2

Author Comment

by:StTwister
ID: 10910984
in both the situations, the form is hidden, but it still apears for a very short amount of time. i want the form not to apear at all.

Thanks
0
 
LVL 3

Accepted Solution

by:
Kunfufaresi earned 60 total points
ID: 10911109
on my computer it didnt apear at all, but maybe that is because the form is totally empty, anyway another idea is to put

form1.top := -1000;

into oncreate of form1, or form1.left := -1000; you couldnt combined this with my previous comment as the form is not visible and thus windows wont bother calling onPaint event. But a timer could do the trick.

Kunfu Faresi
0
 
LVL 2

Author Comment

by:StTwister
ID: 10911409
The form still apears, but this time it disapears much more faster. It probably didn't happen to your computer beacause you're not running on win xp, or u don't have delphi 4

Thanks.
0
 
LVL 2

Author Comment

by:StTwister
ID: 10911429
Sorry, i was wrong, your ideea works just fine.

Thanks.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

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 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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
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 Month8 days, 10 hours left to enroll

764 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