Link to home
Start Free TrialLog in
Avatar of eruj
eruj

asked on

Hiding application

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
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eruj
eruj

ASKER

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?
IMHO,

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

Does it work ? :)
Place this line right before the form is created.

frmMain.ShowMainForm = false;
Oops, now that I look again:

Application.ShowMainForm := false;

Application.CreateForm(...);
in object inspector you can also set

visible := false for form1.
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.
Or you could use a comp called Stealth that is on
www.torrys.com
to hide a form i would set
form1.height:=50
form1.top:=-100

or does that trigger other problems?
Listening...
hello...
a response would be good...
listenning
Listening