andrezzz
asked on
hide my form
i have little programm with form, on form I have TIMER, IdHTTP, IdIOHandlerSocket1.
ny program starts on FormCreate and after it all work is on every second in timer.
but now i must hide my form. the form must not be shown. HOW I CAN CREATE THIS. PLEASE HELP. THX...
ny program starts on FormCreate and after it all work is on every second in timer.
but now i must hide my form. the form must not be shown. HOW I CAN CREATE THIS. PLEASE HELP. THX...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure TForm1.HideSelf;
begin
Hide;
Application.ProcessMessage s;
end;
begin
Hide;
Application.ProcessMessage
end;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i put in
procedure TForm1.FormCreate(Sender: TObject);
Form1.Visible:=False;
and
Application.ShowMainForm:= False;
BUT IT DIDN'T WORK :/
procedure TForm1.FormCreate(Sender: TObject);
Form1.Visible:=False;
and
Application.ShowMainForm:=
BUT IT DIDN'T WORK :/
you need:
Hide;
Application.ProcessMessage s;
to be processed ....
Hide;
Application.ProcessMessage
to be processed ....
Application.ShowMainForm:= False;
Should work. if not put it on the project file not the unit
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFo rm1, Form1);
Application.Run;
Application.ShowMainForm:= False;
end.
Should work. if not put it on the project file not the unit
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFo
Application.Run;
Application.ShowMainForm:=
end.
-Karamja-,
Application.Run;
Application.ShowMainForm:= False;
will be executed after Application is closed ....
Application.Run;
Application.ShowMainForm:=
will be executed after Application is closed ....
Yep my bad, Put it wrong place.
Application.Initialize;
Application.CreateForm(TFo rm1, Form1);
Application.ShowMainForm:= False;
Application.Run;
Application.Initialize;
Application.CreateForm(TFo
Application.ShowMainForm:=
Application.Run;
type
TForm1 = class(TForm)
//.........
private { Private declarations }
ICount: Integer;
public { Public declarations }
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ICount := 0;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Inc(ICount);
if (ICount=1) then
begin
Hide;
Application.ProcessMessage s;
end;
end;
TForm1 = class(TForm)
//.........
private { Private declarations }
ICount: Integer;
public { Public declarations }
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ICount := 0;
end;
procedure TForm1.Timer1Timer(Sender:
begin
Inc(ICount);
if (ICount=1) then
begin
Hide;
Application.ProcessMessage
end;
end;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Mrkaras,
I think You do not understand the question:
andrezzz have written:
> .... on form I have TIMER, IdHTTP, IdIOHandlerSocket1.
> my program starts on FormCreate and after it all work is on every second in timer.
So, actually the TIMER is used in the programm not about to Hide the Form, but for it's general purpose ....
This way the TIMER may be not be destroyed ;-))
emil
I think You do not understand the question:
andrezzz have written:
> .... on form I have TIMER, IdHTTP, IdIOHandlerSocket1.
> my program starts on FormCreate and after it all work is on every second in timer.
So, actually the TIMER is used in the programm not about to Hide the Form, but for it's general purpose ....
This way the TIMER may be not be destroyed ;-))
emil
program Project1;
uses
Windows,
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo rm1, Form1);
ShowWindow(Application.Han dle, SW_HIDE);
Application.Run;
end.
uses
Windows,
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo
ShowWindow(Application.Han
Application.Run;
end.
ASKER
if i use
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo rm1, Form1);
ShowWindow(Application.Han dle, SW_HIDE);
Application.Run;
then my programm windows is on desctop but in toolbar where i switch my windowses the windows of my programm is hiden. i need to hide my programm windows too
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo
ShowWindow(Application.Han
Application.Run;
then my programm windows is on desctop but in toolbar where i switch my windowses the windows of my programm is hiden. i need to hide my programm windows too
ASKER
I use
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo rm1, Form1);
ShowWindow(Application.Han dle, SW_HIDE);
ShowWindow(Application.Mai nForm.Hand le, SW_HIDE);
Application.Run;
and it work BUT IT HAVE SOME SPLASH. I CAN SEE MY WONDOWS IN A VERY LITTLE TIME. HOW I CAN HIDE IT 100%
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo
ShowWindow(Application.Han
ShowWindow(Application.Mai
Application.Run;
and it work BUT IT HAVE SOME SPLASH. I CAN SEE MY WONDOWS IN A VERY LITTLE TIME. HOW I CAN HIDE IT 100%
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TFo rm1, Form1);
Application.ShowMainForm:= False;
ShowWindow(Application.Han dle, SW_HIDE);
ShowWindow(Application.Mai nForm.Hand le, SW_HIDE);
Application.Run;
Application.ShowMainForm := false;
Application.CreateForm(TFo
Application.ShowMainForm:=
ShowWindow(Application.Han
ShowWindow(Application.Mai
Application.Run;
would it help to set the position of the window to someware off the screen (such as setting left to -1000000) as well as hiding your application as yoy have got working? if you set the position with the object inspector you will never see your form but you may still have the taskbar flash up quickly.
also in my previous comment i ment a seperate timer, not the one already on your form (it looks like you got some better answers after my other comment anyway).
also in my previous comment i ment a seperate timer, not the one already on your form (it looks like you got some better answers after my other comment anyway).
Use DataModule, not form, if you have just non-visual components.
unit Unit1;
interface
uses
SysUtils, Classes, Forms;
type
TDataModule1 = class(TDataModule)
// Your Components
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule1: TDataModule1;
implementation
{$R *.dfm}
//Your implementetion
procedure TDataModule1.DataModuleCre ate(Sender : TObject);
begin
While True Do
if Application.Terminated then Break
else
Application.HandleMessage;
end;
end.
unit Unit1;
interface
uses
SysUtils, Classes, Forms;
type
TDataModule1 = class(TDataModule)
// Your Components
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule1: TDataModule1;
implementation
{$R *.dfm}
//Your implementetion
procedure TDataModule1.DataModuleCre
begin
While True Do
if Application.Terminated then Break
else
Application.HandleMessage;
end;
end.
You can get datamodule:
File > New > Datamodule
Remove form first :
Project > Remove from project
File > New > Datamodule
Remove form first :
Project > Remove from project
begin
UnhideLeft := Form.left;
UnhideTop:= Form.Top;
Form.Left:=9999;
Form.Top:=9999;
end;
procedure TForm.Unhide;
begin
Form.Left:=UnhideLeft;
Form.Top:=UnhideTop;
end;