0

hi
how can i terminate a process using vc++
i check somewhere and i found TerminateProcess function
but this is not useful to terminate a process by it's name[for example notepad.exe]
i hope you help me

3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by rbv
0

thanks but i receive Undeclared Identifier 'HANDLE' error
i don't know what should i add

0

my program was under win32 console app
so 'HANDLE' was Undeclared for me
----------
now myApp is under mfc
this is the function

int CMyTaskManagerDlg::Killprocess(int nProcessID)
{
	
	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, nProcessID );

	BOOL nReturnVal = TerminateProcess( hProcess,0);
	CloseHandle (hProcess);
	return nReturnVal;

}

but how can i find the nProcessID for my notepad.exe to close it?

Edited by kiuhnmgrtdcv: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.