Hide Program

How do I hide my program from the CTRL + ALT + DEL and from ALT + TAB etc...I want it to be completely hiddeen
nafa2221Asked:
Who is Participating?
 
hhamsterConnect With a Mentor Commented:
Maybe this one helps. Found it in some tips. Haven't tryed yet.

var
dummy : integer;

begin
dummy := 0;
//Disable ALT-TAB
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 1, @Dummy, 0);
//Disable CTRL-ALT-DEL SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @Dummy, 0);
end.
0
 
EpsylonCommented:
This works in Windows 95/98:


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Hide: TButton;
    Show: TButton;
    procedure HideClick(Sender: TObject);
    procedure ShowClick(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.HideClick(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessId, 1);
end;

procedure TForm1.ShowClick(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessId, 0);
end;

end.
0
 
EpsylonCommented:
Hmmm... it doesn't hide it from ctrl -tab...
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
EpsylonCommented:
It does when form1.visible := false

:o)
0
 
nafa2221Author Commented:
I need code that works under Windows2000 as well ;]
0
 
EpsylonCommented:
I think you can better forget that...
0
 
nafa2221Author Commented:
why is that?
0
 
intheCommented:
yep you wont get code for nt or win2k..

i suggest add epsylons functions as he did and also add these 2 functions after implementation word:

procedure TurnSysKeysOff;
var
  OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (True), @OldVal, 0)
end;

procedure TurnSysKeysBackOn;
var
  OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (False), @OldVal, 0)
end;

instead of buttonclick etc use the
formcreate or formactivate event to call both:

RegisterServiceProcess(GetCurrentProcessId, 1);
TurnSysKeysOff;

and on form destroy call both:
RegisterServiceProcess(GetCurrentProcessId, 0);
TurnSysKeysOn;

that will also Disables alt/tab and crtl/esc..
0
 
nafa2221Author Commented:
can you give me code that will determain if I am in Windows NT and if I am disable CTRL + ALT + DEL all together, and if it is windows 98/95 hide it from the task list? Thanks
0
 
intheCommented:
i gave you code in the other question to tell what operating system your in.

as you are new to delphi it really wont help you learn very well if we paste the whole of your project here and im sure you like to learn it ;-)

to disable ctrl-alt-del in nt is no beginner stuff.
0
 
intheCommented:
it is also not good practice because nt is a multitasking operating system and ctrl-alt-del gives the user access to important functions of the os.
if your program gets stuck how do they kill it?apart from hard reboot..
0
 
EpsylonCommented:
Here you go:


unit Unit1;

interface

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

type
  TRegServ = function (dwProcessID,dwType : DWORD) : DWORD; stdcall;
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var Handle: HINST;
    RegServ: TRegServ;
begin
  if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
  begin
    Handle := LoadLibrary('KERNEL32.DLL');
    if Handle <> 0 then
    begin
      RegServ := GetProcAddress(Handle, 'RegisterServiceProcess');
      RegServ(GetCurrentProcessID, 1);
      FreeLibrary(Handle);
    end;
  end;
end;

end.
0
 
EpsylonCommented:
Btw, hiding from ctrl-tab works on all platforms by hiding the form (or just using no forms at all).

Form1.Visible := false;
0
 
bryan7Commented:
listenning
0
 
nricoCommented:
You can do this in the OnActivate (at least that's what I do)

Procedure Form1.FormActivate(Sender:TObject);
Begin
  ShowWindow(Handle,SW_HIDE);
  ShowWindow(Application.Handle,SW_HIDE);
End;
0
 
PeterLarsenCommented:
Listening
0
 
EpsylonCommented:
hhamster, Barry (inthe) already mentioned that...
0
 
intheCommented:
hhamster ,
how on earth can you propose that as an answer if there are already other comments in the question mentioning it and you havent even tried yet ?

0
 
EpsylonCommented:
I don't like this......
0
 
hhamsterCommented:
Sorry, folks.
Just wanted to help the guy.
I read the question, the threas was still going on and I have this example in some tips downloaded earlier.
I apologise to everyone once again.
0
 
darinwCommented:
Hi all,

Epsylon please see your question at:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10325449 

nafa2221 please choose the comment you accept carefully if you want the help of our Experts - most only want to be treated fairly for the effort they put in to solving YOUR problems.

hhamster, thank you for understanding how the other Experts feel about having their comments reposted as an answer.

darinw
Customer Service
0
 
EpsylonCommented:
Thanks to darinw and Barry. hhamster, apologies accepted.
0
All Courses

From novice to tech pro — start learning today.