Hello,
I already make a terminating processes code. But I want to use it to terminate any running process by specifiying a file path. For example:
stopproc ( "C:\\Windows\\blablabla\\testing\\testing.exe" );
I'm currently can make it to stop process by a specific name and not a specific full path name. Can anyone help me to solve this problem. I really appreciate it if anyone could help.
Here it is my sample code:
- I'm currently making a process viewer program.Code:void stopproc(char * process_name) { register BOOL term; lSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); uProcess.dwSize = sizeof(uProcess); rProcessFound = Process32First(lSnapshot,&uProcess); while(rProcessFound) { if(strstr(uProcess.szExeFile,process_name)!=NULL) { myproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, uProcess.th32ProcessID); if(myproc != NULL) { term=TerminateProcess(myproc,0); } CloseHandle(myproc); } rProcessFound=Process32Next(lSnapshot,&uProcess); } CloseHandle(lSnapshot); }



LinkBack URL
About LinkBacks


