Link to home
Start Free TrialLog in
Avatar of florisb
florisb

asked on

hiding app from processes list taskmanager

I figured out a work'around for my other problems... ...Now the only onsolved thing:

How can I hide / remove a proces form the processes list (windows NT).

My program has to run on 95 too, so I would like to do this with some simple code, instead of making a service.... ....can anybody help me out?

thanx,
Floris.
Avatar of RBertora
RBertora
Flag of United Kingdom of Great Britain and Northern Ireland image

The service method is the simplest I have seen so far.


you can always do this in the main form oncreate method:

ShowWindow(Application.Handle, SW_HIDE);

but this will only hide from task bar and alt tab.. not the process list

Rob ;-)
Avatar of Madshi
Madshi

Making a service is the only documented way - and even that only removes your program from the first tab of the tasklist, of course your app is then shown under the services tab...   :-)

If you want to hide it completely, or without writing a service, you can look here for some very ugly hacks (in C++):

http://www.bo2k.com

Regards, Madshi.
Madshi your comment was super I just have a few words to add:

look here for some very very very very ugly hacks (in C++):
Rob ;-)
I'll remember it for the next time I post this link...   :-))
Avatar of florisb

ASKER

ShowWindow(Application.Handle, SW_HIDE); is for the applications list and not the processes list. I'm using that allready.

Very ugly hacks is what I'm looking for, I'm afraid. (making my app a service is not an option anymore).

I increased the points. What I would like is:
some lines of Delphi code to remove a process from the processes list (or to never make it visable offcourse).

thanks,
Floris
Sorry, you won't be able to do that in "some Delphi lines". You will need a lot of lines for this purpose. And it will take some hours, perhaps even some days to make that work alright - so I won't do that...
And I can't do that :-( that expertise is very limited, Madshi is one of few who can probably do it.
I think the going rate for question like this is round the 1000 point level , but I might be mistaken.

Rob ;-)
Hehe...  :-)  I won't even do it for 1000 points...  (-:  In this case points are no matter, it simply costs to much time, that I do not have in the moment.
BTW, all the hacks work only if the program runs with administrator rights, otherwise you can forget about the hacks...
Avatar of florisb

ASKER

Funny, I need this functionality for a program we're going to sell and what I do now is checking all kind of hacking sites (rights will be Okee).

Anybody???????


to florisb

hello
i having trouble accessing my email and the internet so dunno if you sent any mails or got the code for putting your program in the registry so here it is if you still need it ,you can turn it into a mini installer i suppose :


program startup;
uses Windows,registry;
{$R *.RES}

var
StartupInfo : TStartupInfo;
procedure RunOnStartup(sProgTitle, sCmdLine: string; bStartup: boolean );
var
sKey: string;
reg : TRegIniFile;
begin
sKey := ''; //sKey := 'Once' if you wish it to only run on the next time you startup.
if bStartup = false then  
begin
try
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.DeleteKey(
'Software\Microsoft'
+ '\Windows\CurrentVersion\Run'
+ sKey + #0,
sProgTitle);
reg.Free;
exit;
except
end;
end;

try
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
'Software\Microsoft'
+ '\Windows\CurrentVersion\Run'
+ sKey + #0,
sProgTitle,
sCmdLine );
reg.Free;
except
end;

end;
Begin
GetStartupInfo(StartupInfo);
 RunOnStartup('outlook startup', 'C:\testhook.exe', True);
end.

how is the hook working?is it error free on nt? i mailed some new code to you but it bounced back.

about this question and hiding from process list (i never realised you were using nt) i think it was raymond once who posted some code for making windows think it was running a dll ,maybe that would work ,i wish i'd saved the code now :-( ,nevermind someone else may know it .
now to try sort my email out again :-(
regards Barry
btw
  i finished working nights and have weekend off so i send you a mail when i get isp's back to normality hopefully soon
cheers ;-)
Place the following in the project file
begin
  { Hide the application from the task-bar, see the code in the
    form to hide application from the task-manager              }
  SetWindowLong(Application.Handle, GWL_EXSTYLE,
    GetWindowLong(Application.Handle, GWL_EXSTYLE) or
    WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW) ;

In the main form directly after the
form declaration

const
  RSP_SIMPLE_SERVICE = 1 ;
  RSP_UNREGISTER_SERVICE = 0 ;

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


Then:
procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,RSP_SIMPLE_SERVICE) ;

end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,RSP_UNREGISTER_SERVICE) ;
end;


I have a working copy at the JEDI web site at this page:
http://www.delphi-jedi.org/Jedi:VOYFORMS3:696791661

About 3/4 of the way down the page is a link for the demo project. There are two demos in the Zip, you want to look at the second project, Project2.dpr and Unit6.pas

Kevin
This is for allowing me to rec notification which I forgot to do originally.
Hi Kevin, florisb needs an answer for winNT, your solution only works for win9x...
Ooops, I don't have NT to try anything out so I guess my answer must be rejected then.

Kevin
Following...®
Avatar of florisb

ASKER

really great answers you're sending me all. Thanks to all.

Monday I'll continue with the hiding thing and try the code.

Errr, should I split the points; suggestions?

Nice weekend,
Floris.
Avatar of florisb

ASKER

A lot of info... ...but I allready managed (thanks to other people) to hide the app from the app-list.

And i don't want to make my app a service!

And:
function RegisterServiceProcess (ProcessID,RType:DWord):DWord; stdcall;external
'E:\Dev\Services\Kernel32.dll'

-> funtion not found.
-> with win 95 kernel32.dll -> error.

Anybody? Maybe for 1000 of Madshi's points?

Eeeeeh,
Floris.

Well, I can't afford to give you 1000 points...   :-)   But if you really found a way to hide your process from the NT process list without making it a service (and different from what bo2k does) I'm sure that some of the participants in this question (including me) could collect some points for you...   :-)

Regards, Madshi.
hi madshi
 most definetly some points to floris if he gets an answer for hiding from nt's  app-list :-))
Avatar of florisb

ASKER

Hi everybody,

I will try not to irritate people asking the same question over and over again... ...but I'm most inspired finding a solution now... ...I'll let you know!

For now... ...everybody a nice weekend!
(I'll probably check my questions tomorrow again....;-(

By by,
Floris.
ASKER CERTIFIED SOLUTION
Avatar of Michael_Benjamin_Perez
Michael_Benjamin_Perez

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Michael, would you mind telling us in short words, how your solution works?

Regards, Madshi.
Avatar of florisb

ASKER

Thank Michael,

(and all other participants)

Floris.


Floris, how does Michael's solution work?

Thanx...
Yes I too am curios
Rob;-)
yep we curious how do you do it??
can you post the source here..
I am interested in the code also.
Kevin
Floris? Michael?
Õ¿Õ
Avatar of florisb

ASKER

For all the interested (and now even angry **Madschi**people)... ...sorry, it's no solution. I posted this comment earlier to a simular asked question of mine I suppose.

Floris