Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to terminate a process Pin
_AnsHUMAN_ 1-Dec-08 0:23
_AnsHUMAN_ 1-Dec-08 0:23 
AnswerRe: How to terminate a process Pin
Hamid_RT1-Dec-08 0:27
Hamid_RT1-Dec-08 0:27 
GeneralRe: How to terminate a process Pin
V K 21-Dec-08 0:34
V K 21-Dec-08 0:34 
GeneralRe: How to terminate a process Pin
Hamid_RT1-Dec-08 0:54
Hamid_RT1-Dec-08 0:54 
GeneralRe: How to terminate a process Pin
Code-o-mat1-Dec-08 1:44
Code-o-mat1-Dec-08 1:44 
GeneralRe: How to terminate a process Pin
Stephen Hewitt1-Dec-08 5:30
Stephen Hewitt1-Dec-08 5:30 
AnswerRe: How to terminate a process Pin
SandipG 1-Dec-08 1:01
SandipG 1-Dec-08 1:01 
AnswerRe: How to terminate a process Pin
Randor 1-Dec-08 6:14
professional Randor 1-Dec-08 6:14 
At first you may be attempted to do something like the following:

DWORD CProcessList::Toolhelp32FindProcess(TCHAR szModuleName)
{
	HANDLE hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
	PROCESSENTRY32 processInfo;
	processInfo.dwSize=sizeof(PROCESSENTRY32);

	while(Process32Next(hSnapShot,&processInfo)!=FALSE)
	{
		if(0 == _tcscmp(szModuleName,processInfo.szExeFile)
		{
			return processInfo.th32ProcessID;
		}
	}
	CloseHandle(hSnapShot);
		return -1;
}


But unfortunately there can be multiple instances of the same PE images executing concurrently. To be certain that you are targeting the correct one you will also require a window handle.

You can have a look at a previous post to see How to Find a PID from a window handle[^].

Hope it helps,
-David Delaune

At first
Questionmultithreading Pin
Laan8230-Nov-08 23:54
Laan8230-Nov-08 23:54 
AnswerRe: multithreading Pin
Mattias G1-Dec-08 1:33
Mattias G1-Dec-08 1:33 
GeneralRe: multithreading Pin
Laan821-Dec-08 1:57
Laan821-Dec-08 1:57 
GeneralRe: multithreading Pin
Mattias G1-Dec-08 2:19
Mattias G1-Dec-08 2:19 
GeneralRe: multithreading Pin
Laan821-Dec-08 2:31
Laan821-Dec-08 2:31 
AnswerRe: multithreading Pin
Code-o-mat1-Dec-08 2:06
Code-o-mat1-Dec-08 2:06 
GeneralRe: multithreading Pin
Laan821-Dec-08 2:19
Laan821-Dec-08 2:19 
GeneralRe: multithreading Pin
David Crow1-Dec-08 10:36
David Crow1-Dec-08 10:36 
GeneralRe: multithreading Pin
Laan821-Dec-08 11:20
Laan821-Dec-08 11:20 
QuestionRelease memory using 'delete' operator for 2 dimensional array Pin
Nikesh Jagtap30-Nov-08 23:40
Nikesh Jagtap30-Nov-08 23:40 
QuestionRelease memory using 'delete' operator for 2 dimensional array Pin
Nikesh Jagtap30-Nov-08 23:40
Nikesh Jagtap30-Nov-08 23:40 
AnswerRe: Release memory using 'delete' operator for 2 dimensional array Pin
Code-o-mat30-Nov-08 23:54
Code-o-mat30-Nov-08 23:54 
AnswerRe: Release memory using 'delete' operator for 2 dimensional array Pin
CPallini1-Dec-08 1:33
mveCPallini1-Dec-08 1:33 
GeneralRe: Release memory using 'delete' operator for 2 dimensional array Pin
Code-o-mat1-Dec-08 2:41
Code-o-mat1-Dec-08 2:41 
AnswerRe: Release memory using 'delete' operator for 2 dimensional array Pin
David Crow1-Dec-08 10:41
David Crow1-Dec-08 10:41 
QuestionErr Message :"This file is read-only. You must save to a different filename." Pin
josip cagalj30-Nov-08 23:36
josip cagalj30-Nov-08 23:36 
AnswerRe: Err Message :"This file is read-only. You must save to a different filename." Pin
Hans Dietrich30-Nov-08 23:45
mentorHans Dietrich30-Nov-08 23:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.