Solved

Hiding application

Posted on 2000-03-11
13
169 Views
Last Modified: 2010-04-04
Hi,

how can i prevent my delphi application from be displayed anywhere (nor in the taskbar or in the current running tasks list - the box which shows up when in win95/98 you press CRT+ALT+DELETE).

Thanx
0
Comment
Question by:eruj
13 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
ID: 2608506
this should do it:

const  RSP_SIMPLE_SERVICE = 1;
       RSP_UNREGISTER_SERVICE = 0;

function  RegisterServiceProcess(dwProcessID,dwType : DWORD) : DWORD; stdcall; external 'KERNEL32.DLL';

procedure TForm1.FormActivate(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
  GetWindowLong(Application.Handle, GWL_EXSTYLE)
    or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);  
RegisterServiceProcess(GetCurrentProcessID,RSP_SIMPLE_SERVICE);
end;


procedure TForm1.FormDestroy(Sender: TObject);
begin
RegisterServiceProcess(GetCurrentProcessID,RSP_UNREGISTER_SERVICE);
end;
0
 

Author Comment

by:eruj
ID: 2609162
Hi inthe,

your code works perfectly for hiding the app from the taskbar and current running tasks list, but the main form is still visible. Any suggestions on how to hide it?
0
 
LVL 25

Expert Comment

by:Mr_Peerapol
ID: 2609433
IMHO,

Put Timer in your main form, set its interval to 500, and in TimerEvent do Form.Hide ...

Does it work ? :)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:Vendi
ID: 2609917
Place this line right before the form is created.

frmMain.ShowMainForm = false;
0
 
LVL 1

Expert Comment

by:Vendi
ID: 2609929
Oops, now that I look again:

Application.ShowMainForm := false;

Application.CreateForm(...);
0
 
LVL 17

Expert Comment

by:inthe
ID: 2610170
in object inspector you can also set

visible := false for form1.
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2612257
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function  RegisterServiceProcess(dwProcessID,dwType : DWORD) :
                      DWORD; stdcall; external 'KERNEL32.DLL';

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,1);
end;

procedure TForm1.FormActivate(Sender: TObject);
var
  w: hwnd;
begin
 showwindow(form1.handle,sw_hide);
 w:=findwindow('tapplication',nil);
 showwindow(w,sw_hide);
     {To Totally go Invisible}   //Your missing this
end;

end.


But yeah i agree with Barry, Set your main form to be invisible.... form1.visible:=False; on show or activate.... but this will do it....

Craig C.
0
 
LVL 1

Expert Comment

by:umulig
ID: 2612811
Or you could use a comp called Stealth that is on
www.torrys.com
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2613051
to hide a form i would set
form1.height:=50
form1.top:=-100

or does that trigger other problems?
0
 

Expert Comment

by:Rusfist
ID: 2619474
Listening...
0
 
LVL 17

Expert Comment

by:inthe
ID: 2638143
hello...
a response would be good...
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2678657
listenning
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2679850
Listening
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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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