?
Solved

Hiding application

Posted on 2000-03-11
13
Medium Priority
?
174 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
[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
13 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 120 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month10 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