Solved

Win98 tasklist

Posted on 2000-03-25
12
373 Views
Last Modified: 2010-04-04
How do i hide a Delphi 3 application from Windows 98's tasklist (Ctrl+Alt+Del), i'm a newbie so pls be specific. thanks
0
Comment
Question by:tyfing
  • 6
  • 2
  • 2
  • +2
12 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2656480
Try this:



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;

var
  Form1: TForm1;

function RegisterServiceProcess(dwProcessID,dwType : DWORD) :
                      DWORD; stdcall; external 'KERNEL32.DLL';

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 3

Expert Comment

by:shenqw
ID: 2656481
{A demo}

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

 Const RSP_SIMPLE_SERVICE = 1;
 Const RSP_UNREGISTER_SERVICE = 0;
 function RegisterServiceProcess(dwProcessID,dwType:DWORD):DWORD;stdcall;

var
  Form1: TForm1;

implementation

{$R *.DFM}
 function RegisterServiceProcess(dwProcessID,dwType:DWORD):DWORD;external 'kernel32.dll';


procedure MakeMeService;
var
  pid,
  reserv:DWORD;
begin
  pid:=GetCurrentProcessId;
  reserv := RegisterServiceProcess(pid,RSP_SIMPLE_SERVICE);
end;

procedure UnMakeMeService;
var
  pid,
  reserv:DWORD;
begin
  pid := GetCurrentProcessId;
  reserv := RegisterServiceProcess(pid,RSP_UNREGISTER_SERVICE);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MakeMeService;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  UnMakeMeService;
end;

end.


0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2656496
Hi Shengw, nice answer  :o)
but I was slightly first so would to mind to withdraw your answer...
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:tyfing
ID: 2656748
epsylon's one is short and much sweeter and it works 100% fine.
0
 

Author Comment

by:tyfing
ID: 2656750
epsylon, thanks for your help but i have lost the email informing me of your aid...why don't you post another solution, well....just change the button's name or something to make it different and i will gladly accept it and accept ur solution. :)
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2656811
Tyfing, I see that you are new here so a little explanation how this site works.
Each comment has a button. Scroll up and look for the comment that you want to accept as answer and click on this button. The rest is easy...

Cheers.
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2656926
Cheers:
  I'm shenqw,not shengw.  
  Congratulations!!!
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2656969
Sorry shenqw, didn't see that. There's no difference between the 'g' and the 'q' when it is underlined   :o)

very confusing......
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 50 total points
ID: 2658026
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    HideIt: TButton;
    ShowIt: TButton;
    procedure HideClick(Sender: TObject);
    procedure ShowClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

function RegisterServiceProcess(dwProcessID,dwType : DWORD) :
                      DWORD; stdcall; external 'KERNEL32.DLL';

implementation

{$R *.DFM}

procedure TForm1.HideItClick(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID, 1);
end;

procedure TForm1.ShowItClick(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID, 0);
end;

end.

0
 
LVL 1

Expert Comment

by:yk030299
ID: 2659414
listen
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2661644
Very nice,
Is it really so easy - hmmm !!
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2671349
Please grade...
0

Featured Post

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.

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…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

789 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