Please nominate your Qt Champions for 2021!

[SOLVED] How to close external application or process from QT

  • i need to close all browser of my system from QT.
    It must be work on Windows and Linux. i found Qprocess. I searching hours for an example of using kill or terminate for external application like google chrome but failed. can anyone help me please.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You would first need to get a list of the current running instance using e.g. ps -A. You can then parse that to retrieve the PID's of the application you want to stop and then use that to send the proper kill command.

    Hope it helps

  • @SGaist
    Thank you very much.
    i find solution based on your idea and the program can close any external app with it's name.
    thank you

  • Lifetime Qt Champion

    You're welcome !

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

    Also, while browsing the forum, consider up-voting the answers that helped you, that will make them easier to find for other users :)

  • @SGaist
    Ok my dear friend.
    Thank you again for your advise.

Log in to reply