adholioshake
Programmer
- Feb 9, 2003
- 136
I have a problem with terminating 2 processes. The program I have wrote so far is as follows:
This program works when the process number is known. I want to find out the name of the process to check whether to terminate it with the 'EnumProcesses' function scanning through all processes. This is because the process number can change, but the name of the process will not. Can anyone help me here ??
Thanks, Adonai.
Code:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HANDLE proc1;
HANDLE proc2;
// Open processes...
proc1 = OpenProcess(PROCESS_TERMINATE, TRUE, 0x3c4);
proc2 = OpenProcess(PROCESS_TERMINATE, TRUE, 0x494);
// ...then Kill them (!)
TerminateProcess(proc1, 1);
TerminateProcess(proc2, 1);
return(0);
}
Thanks, Adonai.