Important: Please read the Qt Code of Conduct -

[SOLVED] Qt Application can not be killed by cmd

  • Hello... I have already asked why I can not minimize / maximize application built with Qt using ShowWindow... Now I am trying to kill it / terminate using command line... And I figured out I can not kill it if CMD is not run with administrator rights... I can kill Notepad.exe or any other Qt application, but just that one not...

    "Here": is problem with minimize / maximize

    I believe these two things are connected... I can not minimize / maximize / kill application due to lack of rights... Any idea what is the reason application is requesting so many rights... How can I kill it if I don't run command line / powershell with admin rights?

    This also gives me error due to lack of rights... Is there a way to run system() with admin rights?
    @system("taskkill /pid <pid>)@

    bq. ERROR: The process with PID 7745 could not be terminated.
    Reason: Access is denied.

    I am administrator and I also gave all permissions to the app... But still does not work...

  • Code below did the magic :)
    @ShellExecute(0, L"runas", L"cmd.exe", L"/C taskkill /F /pid 2104> out.txt", 0, SW_NORMAL)@

Log in to reply