Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Run desktop program with administration privileges on Windows platform
Forum Updated to NodeBB v4.3 + New Features

Run desktop program with administration privileges on Windows platform

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 366 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JulianJ Offline
    JulianJ Offline
    Julian
    wrote on last edited by
    #1

    Hello comunity.

    There is a way to set up by code that a Qt application (a program wrote with Qt) lunch with administration privileges?

    I mens, when it runs for first time Windows ask the user that this program will need privilges administration.

    Thanks in advance.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need to embed a manifest file to request to desired rights. There is a lot of help when searching for 'uac manifest' in the net.
      The Linker command for msvc is described here: https://msdn.microsoft.com/de-de/library/bb384691.aspx

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Getting the right amount of escape characters for this in qmake is a bit tricky, so here's a code snippet you can copy/paste to your .pro file:

        QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:"level='requireAdministrator'"
        

        Don't forget to re-run qmake after that (Build->Run qmake).

        1 Reply Last reply
        6

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved