Solved

Hide Program

Posted on 2000-04-02
22
200 Views
Last Modified: 2010-04-04
How do I hide my program from the CTRL + ALT + DEL and from ALT + TAB etc...I want it to be completely hiddeen
0
Comment
Question by:nafa2221
  • 9
  • 4
  • 3
  • +5
22 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678062
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
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678071
Hmmm... it doesn't hide it from ctrl -tab...
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678080
It does when form1.visible := false

:o)
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:nafa2221
ID: 2678082
I need code that works under Windows2000 as well ;]
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678126
I think you can better forget that...
0
 

Author Comment

by:nafa2221
ID: 2678134
why is that?
0
 
LVL 17

Expert Comment

by:inthe
ID: 2678144
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
 

Author Comment

by:nafa2221
ID: 2678164
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
 
LVL 17

Expert Comment

by:inthe
ID: 2678186
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
 
LVL 17

Expert Comment

by:inthe
ID: 2678195
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
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678209
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
 
LVL 13

Expert Comment

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

Form1.Visible := false;
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2678615
listenning
0
 
LVL 1

Expert Comment

by:nrico
ID: 2679298
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
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2679844
Listening
0
 
LVL 2

Accepted Solution

by:
hhamster earned 100 total points
ID: 2691602
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
 
LVL 13

Expert Comment

by:Epsylon
ID: 2691619
hhamster, Barry (inthe) already mentioned that...
0
 
LVL 17

Expert Comment

by:inthe
ID: 2697125
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
 
LVL 13

Expert Comment

by:Epsylon
ID: 2697572
I don't like this......
0
 
LVL 2

Expert Comment

by:hhamster
ID: 2697916
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
 
LVL 3

Expert Comment

by:darinw
ID: 2698448
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
 
LVL 13

Expert Comment

by:Epsylon
ID: 2698498
Thanks to darinw and Barry. hhamster, apologies accepted.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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