Solved

How To hide my application from tasklist? (win95/98)

Posted on 1998-11-21
14
384 Views
Last Modified: 2010-04-04
Hi!
    I tried to hide my application with following code:

    var i:longint;
        handle:longint;
    begin
    i:=GetCurrentProcessId;
    handle:=OpenProcess(PROCESS_ALL_ACCESS,true,i);
    RegisterServiceProcess(handle,1);
    end;

It do not work. Any idea?
0
Comment
Question by:drol
  • 4
  • 2
  • 2
  • +4
14 Comments
 

Expert Comment

by:bdtikast
ID: 1347527
At designtime I set the mainform invisible and Application.ShowMainForm to false. Below is the part in the application's .DPR I changed (View, Project Source).

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.ShowMainForm:= false;
  Form1.Visible:= false;
  Application.Run;
end.

0
 
LVL 1

Expert Comment

by:xpher
ID: 1347528
drol

I have done this to hide the button from the taskbar. Added this to the project source (you must also add Windows to uses)
example

program YourApplication;

uses
  Windows,
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {AboutForm};

{$R *.RES}

begin
  Application.Initialize;
  Application.ShowMainForm := False;
  Application.Title := 'Your Application';
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TAboutForm, AboutForm);
  ShowWindow(Application.Handle, SW_HIDE);
  Application.Run;
end.
0
 
LVL 1

Expert Comment

by:xpher
ID: 1347529
if you wanted to show it again you would use SW_RESTORE inplace of SW_HIDE

Regards
Chris
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1347530
drol,

even though "RegisterServiceProcess" is supposed to register the application with the given handle, i have never seen/heard that it worked with third party programs.

if you are trying to remove YOUR program from the tasklist then you can call RSP with a parameter of 0 rather than the handle. The following works perfectly in Delphi.

ok := RegisterServiceProcess (0, RSP_SIMPLE_SERVICE);
if ok  = 0 then ShowMessage ('Error Registering Service');

i guess this is the info you're looking for.
0
 

Expert Comment

by:msac_m
ID: 1347531
Hi all,

  I could not undertand why you used OpenProcess, Simply try this

  RegisterServiceProcess(GetCurrentProcessID,1);

And as bdtikast  do not forget to hide the mainform

That is all I think,

Regards,

0
 

Expert Comment

by:msac_m
ID: 1347532
Sorry for mistyping the third to last line of my comment, it  would be

"And as bdtikast  SAID,  do not forget to hide the mainform "

Regards.
0
 

Author Comment

by:drol
ID: 1347533
i want to hide my application from tasklist not from taskbar.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:drol
ID: 1347534
registerserviceprocess(0,1) does not work.
i'm running win98.
I use delphi 3 and include the function from kernel32.dll as 'external'. is there a unit that includes the function?

where in the code you use the function?
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 80 total points
ID: 1347535
Hi drol,

this should work :

const
  RSP_SIMPLE_SERVICE = 1;
  RSP_UNREGISTER_SERVICE = 0;

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

When the program starts :
RegisterServiceProcess(GetCurrentProcessID, RSP_SIMPLE_SERVICE);

When the program stops :
RegisterServiceProcess(GetCurrentProcessID, RSP_UNREGISTER_SERVICE);

Regards, Zif.
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1347536
drol,

RegisterServiceProcess(0, 1) works in Win95.
i Register the my serivces in the FormCreate method.
0
 

Author Comment

by:drol
ID: 1347537
Thank you all!
Now, it works.
I forgot the 'stdcall' statement. :-)
0
 
LVL 1

Expert Comment

by:sageryd
ID: 1347538
How do I hide the application from the taskbar and still have the main form unhidden?
0
 

Author Comment

by:drol
ID: 1347539
Hi Sageryd

try
Application.ShowMainForm:=false;
0
 
LVL 1

Expert Comment

by:sageryd
ID: 1347540
WRONG! That hides the form AND the taskbar-button. I want something that only hides my application from the taskbar, not the MainForm!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now