Important: Please read the Qt Code of Conduct -

Windows - Is my QT app running as Administrator?

  • Hi all,

    Is there a way in QT to tell if my application is running as Administrator? If not, is anybody able to point me in the direction of a Win32 API way of doing it?

    If your interested, the background: Drag and drop does not work when an application is run as administrator, as Windows Explorer is not run with the same level of rights. Usually my app is not run with Administrator rights, except when run at the end of the installer (as it runs as a child process and the installer needs Administrator rights). In this one instance, my massive graphic of "Drop your files here" seems silly!


  • Interesting question in itself. I don't think Qt has API that will help you here. However, why not fix the other end of the issue first? I mean: does your installer really have to run your application for admin rights? It seems to me, that your installer should be able to run your application as the user that is logged in, instead of with elevated rights. That would solve your issue as well, and sounds like the better solution to me.

  • Hi Andre,

    Thanks for your reply. However, unfortunately I don't have that control over the installer (basically I create an installer in NSIS, then a third party wraps it in their own installer). Hence me hoping there was another way!

    If it can't be acheived within my code, I think my only other option would be for me to get the installer to not offer the option to "Run Now". This way the user must manually run the application so drag and drop will work. Far from ideal, however better than some features not working!

Log in to reply