Important: Please read the Qt Code of Conduct -

How to kill a windows process if running from my Qt Application?

  • I am working on an Installer which is implemented in Qt.
    During un-installation (using this qt installer ) this should kill a windows process if its running.
    So my point is : Is its possible i can get the list of processes which are running and i can get the PID and kill them using Qt APIs?

    Thanks in advance.


  • No, Qt does not have API for that. You'll have to use platform specific API's. That should not be a problem, since installers are generally windows-specific anyway.

  • that means i have to use windows specific apis in my Qt App. the thing is this installer can be used on Unix too.

  • I would suggest you use the appropriate linux packaging system for deployment on linux.

  • Moderators

    You can use #ifdef Q_OS_WIN or something to mask out your windows code when not building on windows or put the OS specific code into separate files and have the build system sort out which object files to link together.

Log in to reply