get all running processes info using QProcess

Posted by kaycee on Stack Overflow See other posts from Stack Overflow or by kaycee
Published on 2010-04-13T19:31:54Z Indexed on 2010/04/13 20:53 UTC
Read the original article Hit count: 407

Filed under:
|

few days ago i asked about how to get all running processes in the system using QProcess. i found a command line that can output all processes to a file:

C:\WINDOWS\system32\wbem\wmic.exe" /OUTPUT:C:\ProcessList.txt PROCESS get Caption

this will create C:\ProcessList.txt file contains all running processes in the system. i wonder how can i run it using QProcess and take its output to a variable.

it seems every time i try to run it and read nothing happens:

QString program = "C:\\WINDOWS\\system32\\wbem\\wmic.exe";
QStringList arguments;
arguments << "/OUTPUT:C:\\ProcessList.txt" <<"PROCESS"<< "get"<< "Caption";

process->setStandardOutputFile("process.txt");
process->start(program,arguments);

QByteArray result = process->readAll();

i prefer not to create process.txt at all and to take all the output to a variable...

© Stack Overflow or respective owner

Related posts about qt

Related posts about qprocess