Solved

Hiding application

Posted on 2000-03-11
13
167 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

22 Experts available now in Live!

Get 1:1 Help Now