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. Qt service with gui
Forum Updated to NodeBB v4.3 + New Features

Qt service with gui

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 7 Posters 2.5k Views 7 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.
  • F franco.amato
    6 Jul 2024, 15:46

    @JonB no is not what I asked. You should re read my first post.

    J Offline
    J Offline
    JonB
    wrote on 6 Jul 2024, 19:08 last edited by JonB 7 Jun 2024, 19:09
    #14

    @franco-amato said in Qt service with gui:

    You should re read my first post.

    I have read it many times, thanks. Best of luck showing a UI from a Windows service.

    F 1 Reply Last reply 6 Jul 2024, 19:37
    1
    • J JonB
      6 Jul 2024, 19:08

      @franco-amato said in Qt service with gui:

      You should re read my first post.

      I have read it many times, thanks. Best of luck showing a UI from a Windows service.

      F Offline
      F Offline
      franco.amato
      wrote on 6 Jul 2024, 19:37 last edited by
      #15

      @JonB said in Qt service with gui:

      @franco-amato said in Qt service with gui:

      You should re read my first post.

      I have read it many times, thanks. Best of luck showing a UI from a Windows service.

      If you had read it you would have seen that I stated the following: "I know that a Windows service usually doesn't have a GUI and I'm not sure it can have one". What I asked is whether the path of service is the right path or if there are other solutions to achieve my need

      J 1 Reply Last reply 6 Jul 2024, 19:44
      0
      • F franco.amato
        6 Jul 2024, 19:37

        @JonB said in Qt service with gui:

        @franco-amato said in Qt service with gui:

        You should re read my first post.

        I have read it many times, thanks. Best of luck showing a UI from a Windows service.

        If you had read it you would have seen that I stated the following: "I know that a Windows service usually doesn't have a GUI and I'm not sure it can have one". What I asked is whether the path of service is the right path or if there are other solutions to achieve my need

        J Offline
        J Offline
        JonB
        wrote on 6 Jul 2024, 19:44 last edited by JonB 7 Jun 2024, 19:46
        #16

        @franco-amato said in Qt service with gui:

        If you had read it

        Thanks again. It's always nice to try to help people, just what we like to hear.

        I read your post carefully, as I said. All I ever answered was that I think you will find it difficult to run a UI from a service. You asked if that was the "right path", I suggested it is not. Sorry if you didn't want to hear that. Why don't you leave me out now, thanks.

        1 Reply Last reply
        1
        • S SGaist
          6 Jul 2024, 16:28

          Hi,

          One possible cheat is that you use a QProcess to start a new instance of your application if somebody stops it.
          From a design point of view, you can forbid your user to close the application by handling the close event yourself. A starting point might be the QSystemTrayIcon example.
          Note that this does not protect your application from getting killed but you can still handle the usual interruption signals.
          The system service + client application combo is still worth exploring as you can have the service providing the core functionality and the application being merely a front-end.

          F Offline
          F Offline
          franco.amato
          wrote on 6 Jul 2024, 20:03 last edited by
          #17

          @SGaist Can you help with a small example regarding this "One possible cheat is that you use a QProcess to start a new instance of your application if somebody stops it." ?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 6 Jul 2024, 20:06 last edited by
            #18
            // rest of the code
            int result = app.exec();
            QProcess::startDetached("your_application");
            return result;
            

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            F 1 Reply Last reply 6 Jul 2024, 20:21
            0
            • S SGaist
              6 Jul 2024, 20:06
              // rest of the code
              int result = app.exec();
              QProcess::startDetached("your_application");
              return result;
              
              F Offline
              F Offline
              franco.amato
              wrote on 6 Jul 2024, 20:21 last edited by
              #19

              @SGaist said in Qt service with gui:

              // rest of the code
              int result = app.exec();
              QProcess::startDetached("your_application");
              return result;
              

              It worked but now I am not able to stop it anymore :)) and I am the admin

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 7 Jul 2024, 07:56 last edited by
                #20

                You will have to implement some checks to determine who stopped the application.

                Note that you also need to implement graceful shutdown for when you stop/restart your machine.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                F 1 Reply Last reply 7 Jul 2024, 14:03
                1
                • S SGaist
                  7 Jul 2024, 07:56

                  You will have to implement some checks to determine who stopped the application.

                  Note that you also need to implement graceful shutdown for when you stop/restart your machine.

                  F Offline
                  F Offline
                  franco.amato
                  wrote on 7 Jul 2024, 14:03 last edited by
                  #21

                  @SGaist said in Qt service with gui:

                  You will have to implement some checks to determine who stopped the application.

                  Note that you also need to implement graceful shutdown for when you stop/restart your machine.

                  It's not clear what you mean with graceful shutdown. Can you give an example please?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 7 Jul 2024, 14:36 last edited by
                    #22

                    Simply when you want to shutdown or reboot the machine for example when applying security fixes, kernel update, system updates, etc.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Sikander Rafiq
                      wrote on 15 May 2025, 11:13 last edited by
                      #23

                      @franco.amato Will you be able to make QT service with GUI or launch QT app with GUI from Qt service?

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        franco.amato
                        wrote 25 days ago last edited by
                        #24

                        Yes I am

                        1 Reply Last reply
                        0
                        • mrdebugM Offline
                          mrdebugM Offline
                          mrdebug
                          wrote 24 days ago last edited by
                          #25

                          If you want to prevent that a user to close you app you shoud:

                          • implement the closeEvent() event to reply "no".
                          • work with machine criteria to disable task manager etc to normal users.

                          Hi, if you want to try to use your app (with gui) as windows service you can use this.
                          https://www.denisgottardello.it/InstallAsService/index.php
                          The gui will not be visible.

                          Need programmers to hire?
                          www.labcsp.com
                          www.denisgottardello.it
                          GMT+1
                          Skype: mrdebug

                          1 Reply Last reply
                          0

                          • Login

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