Hi,
I tried to kill processes via Qt/QML and no Qt API works (e.g. QProcess:terminate("test.exe");
The native C++ way works fine, check this tutorial:
1. add
TARGET.CAPABILITY += PowerMgmt
LIBS += apgrfx.lib
to your .pro file into symbian part
2. include
#include <apgtask.h>
#include <eikenv.h>
to your class
3. create a void method:
yourClass:void kill(QString process) or Q_INVOKABLE void kill(QString process)
{
TPtrC16 symprocess(reinterpret_cast<const TUint16*>(process.utf16())); //convert QString to native Char
TFullName res;
TFindProcess find(symprocess);
while(find.Next(res) == KErrNone)
{
RProcess ph;
User::LeaveIfError(ph.Open(find));
ph.Kill(KErrNone);
ph.Close();
}
4.
if you want to kill by UID:
write your UID into "*[]*" without 0x, e.g. "*[100058F3]*"
if you want to kill by name:
use add a * to .exe name, e.g. "sysap.exe*"
two examples:
TFindProcess find(_L("*[100058F3]*")); //reboot via UID
TFindProcess find(_L("sysap.exe*")); //reboot via Name
Regards
P.S.: Killing sysap.exe a.k.a. 0x100058F3 causes a reboot, offical reboot API is private, so this is a nice workaround