N
N
Nik_Haker2015-08-09 22:24:51
Programming
Nik_Haker, 2015-08-09 22:24:51

Why is the process not being killed in c++ using taskkilla?

I work in c++ builder. program1 should work like this:
1. program1 started, launched program2, which is located in the neighboring folder
2. the program2 process is killed (you can’t delete it without terminating the process)
3. program2 is deleted,
it works fine when program 2 is, for example, a homemade calculator. But when prog2 is a keylogger/keystroke interceptor (for which all this was done), then the process is not killed and remains running and prog2 is not deleted.
here is the code:
the file existence is checked:
if ( !access ("folder/program. exe", 0) ){
WinExec( "folder\\program. exe", 1);
system("taskkill /IM prog.exe");
}
}
-------------------------------------------------- -------------------------
and this is a timer, because sometimes the process does not have time to kill and is not deleted
{
remove("folder / program. exe") ;
Timer1->Enabled=false;
}
maybe there are other ways to kill the process?
please help, good people are very necessary for one evil person))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zelimkhan Beltoev, 2015-08-09
@Beltoev

Use TerminateProcess to terminate a process.
In order not to shit code with timers, use the WaitFor functions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question