Teen Programmers Unite  
 

 

Return to forum top

Windows API trick..

Posted by shroomrefic29 [send private reply] at October 03, 2001, 08:53:02 PM

Hey I forgot how to do this but... How do I remove a program from the task list?

Posted by taubz [send private reply] at October 04, 2001, 12:32:29 PM

EndProcess? TerminateProcess? Something like that. Look under Processes in the SDK.

- taubz

Posted by nt543 [send private reply] at October 04, 2001, 06:59:04 PM

Here is how you remove the current process from the task list in Windows 9X/ME:

HINSTANCE hLib;
DWORD (* lpfnRegisterServiceProcess)(DWORD, DWORD);

hLib = LoadLibrary("kernel32.dll");
lpfnRegisterServiceProcess = (DWORD (*)(DWORD, DWORD))GetProcAddress(hLib, "RegisterServiceProcess");
if(lpfnRegisterServiceProcess)
{
ret = (*lpfnRegisterServiceProcess)(0, reg ? TRUE : FALSE);
FreeLibrary(hLib);
return(ret != 1);
}
else
{
MessageBox(0, "Unable to find RegisterServiceProcess() in KERNEL32.DLL", NULL, MB_ICONERROR | MB_OK);
return(1);
}
return(0);

The declaration of RegisterServiceProcess() is:
DWORD RegisterServiceProcess(dwProcessID, dwIsService);
The process ID is 0 for the current process

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.