HANDLE lProcSnapshot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
lRes=Process32First(lProcSnapshot,&procEntry);
while(lRes)
{
if (procEntry.szExeFile == "myapp.exe")
{
hProcess = (HANDLE)procEntry.th32ProcessID;
if (!TerminateProcess(hProcess,113))
{
dwLaseError = GetLastError();
}
break;
}
lRes=Process32Next(lProcSnapshot,&procEntry);
}
CloseToolhelp32Snapshot(lProcSnapshot);
The process found, but I get dwLaseError = 6
Which is: ERROR_INVALID_HANDLE The handle is invalid.
Thanks,
David
Given the process ID you can pass it to OpenProcess to retrieve the handle
to use in TerminateProcess.
Check even %_WINCEROOT%\PUBLIC\WCESHELLFE\OAK\TASKMAN to see how Task
Manager kills processes
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Davidw" <da...@weinstein-d.com> ha scritto nel messaggio
news:OqpQ1PAd...@TK2MSFTNGP06.phx.gbl...
Paul T.
"Davidw" wrote:
> .
>
--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT Eurotech DOT com
My BLOG http://geekswithblogs.net/bruceeitman
Eurotech Inc.
www.Eurotech.com
"Davidw" <da...@weinstein-d.com> wrote in message
news:OqpQ1PAd...@TK2MSFTNGP06.phx.gbl...