Get Application Name ..



  • @
    #include <QtCore/QCoreApplication>
    #include <QProcess>
    #include <QDebug>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    QProcess process;
    process.setReadChannel(QProcess::StandardOutput);
    process.setReadChannelMode(QProcess::MergedChannels);
    

    // process.start("cmd.exe /C echo test");
    process.start("wmic.exe /OUTPUT:STDOUT PROCESS get Caption");

    process.waitForStarted(1000);
    process.waitForFinished(1000);
    
    QByteArray list = process.readAll();
    qDebug() << "Read" << list.length() << "bytes";
    qDebug() << list;
    

    }
    @

    I use this program to list out all process which are running.. but i want to get application names which started by user and they are at running state..like vlc media player,ms word etc. ..

    Thanks in advance..

    Gerolf: Added code tags


  • Moderators

    Please use "code wrappings as explained here":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 This makes your code readable.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.