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 At Startup
Qt 6.11 is out! See what's new in the release blog

Run At Startup

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 4 Posters 16.7k 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.
  • Epiales666E Offline
    Epiales666E Offline
    Epiales666
    wrote on last edited by
    #1

    Hey all,

    I'm wondering if there's a way to run a program WITHIN QT at startup of the qt program? I've searched the internet for awhile now and can't find anything about it.

    What I'm doing. I have a QT program that I've created, but at the top of the program, I want to run the resource monitor inside the program. I need the resource monitor to actually start and show when I run the qt application. Is this possible? Thanks all!

    Be Blessed!
    Epiales666

    JonBJ 1 Reply Last reply
    0
    • F Offline
      F Offline
      Fuel
      wrote on last edited by
      #2

      You mean the Windows Resource Monitor? I dont think so. Its Part of the OS. There are no Functions to implement it in your own Program. Maybe with C# but i dont know.

      Epiales666E 1 Reply Last reply
      1
      • F Fuel

        You mean the Windows Resource Monitor? I dont think so. Its Part of the OS. There are no Functions to implement it in your own Program. Maybe with C# but i dont know.

        Epiales666E Offline
        Epiales666E Offline
        Epiales666
        wrote on last edited by
        #3

        @Fuel said in Run At Startup:

        You mean the Windows Resource Monitor? I dont think so. Its Part of the OS. There are no Functions to implement it in your own Program. Maybe with C# but i dont know.

        It's not necessarily the windows resource monitor, but another 3rd party resource monitor that shows in just one line on my computer. I would like it to run in the actual program I have created. But yeah, something like that. As stated, I've hunted awhile now online and haven't found anything related to what I'm wanting to do. So I decided to give in and just ask lol.

        Be Blessed!
        Epiales666

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          Hi
          Maybe i don't understand clearly what you are trying
          but can you just start the other external .exe program using QProcess ?
          When you app starts up.

          Epiales666E 1 Reply Last reply
          2
          • mrjjM mrjj

            Hi
            Maybe i don't understand clearly what you are trying
            but can you just start the other external .exe program using QProcess ?
            When you app starts up.

            Epiales666E Offline
            Epiales666E Offline
            Epiales666
            wrote on last edited by
            #5

            @mrjj said in Run At Startup:

            Hi
            Maybe i don't understand clearly what you are trying
            but can you just start the other external .exe program using QProcess ?
            When you app starts up.

            Yeah, I tried something like this:

                QString program = "C:/resomonitor.exe";
                QStringList arguments;
                arguments << "-style" << "motif";
            
                QProcess *myProcess = new QProcess(parent);
                myProcess->start(program, arguments);
            

            But nothing works. The program still runs with no errors, but nothing happens.

            Be Blessed!
            Epiales666

            mrjjM 1 Reply Last reply
            0
            • Epiales666E Epiales666

              @mrjj said in Run At Startup:

              Hi
              Maybe i don't understand clearly what you are trying
              but can you just start the other external .exe program using QProcess ?
              When you app starts up.

              Yeah, I tried something like this:

                  QString program = "C:/resomonitor.exe";
                  QStringList arguments;
                  arguments << "-style" << "motif";
              
                  QProcess *myProcess = new QProcess(parent);
                  myProcess->start(program, arguments);
              

              But nothing works. The program still runs with no errors, but nothing happens.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @Epiales666

              is that a Qt program? (resomonitor.exe)
              the -style suggest it.
              Also if u go to c:\ and click on it , it will run ?

              did you try with other program for test ?
              like notepad.exe

              Epiales666E 1 Reply Last reply
              1
              • mrjjM mrjj

                @Epiales666

                is that a Qt program? (resomonitor.exe)
                the -style suggest it.
                Also if u go to c:\ and click on it , it will run ?

                did you try with other program for test ?
                like notepad.exe

                Epiales666E Offline
                Epiales666E Offline
                Epiales666
                wrote on last edited by
                #7

                @mrjj said in Run At Startup:

                @Epiales666

                is that a Qt program? (resomonitor.exe)
                the -style suggest it.
                Also if u go to c:\ and click on it , it will run ?

                did you try with other program for test ?
                like notepad.exe

                No, it's a 3rd part resource monitor. And yeah, if I go there and click, it runs. I can either put the .exe in C:/ or I can use AHK (autohotkey) to make a file to run it. But either way, I can't get the program to start using Qprocess. I"m sure there's a way to do it, but I haven't found it yet. Thank you!

                Be Blessed!
                Epiales666

                mrjjM 1 Reply Last reply
                0
                • Epiales666E Epiales666

                  @mrjj said in Run At Startup:

                  @Epiales666

                  is that a Qt program? (resomonitor.exe)
                  the -style suggest it.
                  Also if u go to c:\ and click on it , it will run ?

                  did you try with other program for test ?
                  like notepad.exe

                  No, it's a 3rd part resource monitor. And yeah, if I go there and click, it runs. I can either put the .exe in C:/ or I can use AHK (autohotkey) to make a file to run it. But either way, I can't get the program to start using Qprocess. I"m sure there's a way to do it, but I haven't found it yet. Thank you!

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  @Epiales666
                  It normally just works.
                  Also, just use notepad.exe did not work either ??

                  try this oneliner
                  bool ok = QProcess::startDetached("notepad.exe");

                  Epiales666E 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @Epiales666
                    It normally just works.
                    Also, just use notepad.exe did not work either ??

                    try this oneliner
                    bool ok = QProcess::startDetached("notepad.exe");

                    Epiales666E Offline
                    Epiales666E Offline
                    Epiales666
                    wrote on last edited by
                    #9

                    @mrjj said in Run At Startup:

                    bool ok = QProcess::startDetached("notepad.exe");

                    Yeah, I get the error

                    warning: C4189: 'ok' : local variable is initialized but not referenced

                    But it opens notepad.

                    Be Blessed!
                    Epiales666

                    mrjjM 1 Reply Last reply
                    0
                    • Epiales666E Epiales666

                      @mrjj said in Run At Startup:

                      bool ok = QProcess::startDetached("notepad.exe");

                      Yeah, I get the error

                      warning: C4189: 'ok' : local variable is initialized but not referenced

                      But it opens notepad.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #10

                      @Epiales666
                      it is just warning telling we did not use bool ok for anything and that
                      is right :)
                      ok so now try with

                      c:\\resomonitor.exe
                      

                      if that cannot start, i am guessing on it needs extra dlls that the
                      environment inside QProcess is not setup to find.

                      Epiales666E 1 Reply Last reply
                      1
                      • mrjjM mrjj

                        @Epiales666
                        it is just warning telling we did not use bool ok for anything and that
                        is right :)
                        ok so now try with

                        c:\\resomonitor.exe
                        

                        if that cannot start, i am guessing on it needs extra dlls that the
                        environment inside QProcess is not setup to find.

                        Epiales666E Offline
                        Epiales666E Offline
                        Epiales666
                        wrote on last edited by
                        #11

                        @mrjj said in Run At Startup:

                        c:\resomonitor.exe

                        Nope, doesn't do anything either :(

                        Thank you for taking the time to help m8. I'll keep messing around with it... tytyty

                        Be Blessed!
                        Epiales666

                        mrjjM 1 Reply Last reply
                        0
                        • Epiales666E Epiales666

                          @mrjj said in Run At Startup:

                          c:\resomonitor.exe

                          Nope, doesn't do anything either :(

                          Thank you for taking the time to help m8. I'll keep messing around with it... tytyty

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by mrjj
                          #12

                          @Epiales666

                          im pretty sure it just needs some extra dlls.
                          Did you just take it from its installation folder and
                          put alone in c:\ ?
                          and u did use 2 backslashes ?

                          c:\\xx.exe <-- 2 in code
                          

                          Is it a public free one i could also download?

                          Epiales666E 1 Reply Last reply
                          1
                          • mrjjM mrjj

                            @Epiales666

                            im pretty sure it just needs some extra dlls.
                            Did you just take it from its installation folder and
                            put alone in c:\ ?
                            and u did use 2 backslashes ?

                            c:\\xx.exe <-- 2 in code
                            

                            Is it a public free one i could also download?

                            Epiales666E Offline
                            Epiales666E Offline
                            Epiales666
                            wrote on last edited by
                            #13

                            @mrjj said in Run At Startup:

                            @Epiales666

                            im pretty sure it just needs some extra dlls.
                            Did you just take it from its installation folder and
                            put alone in c:\ ?
                            and u did use 2 backslashes ?

                            c:\\xx.exe <-- 2 in code
                            

                            Is it a public free one i could also download?

                            Okay, here is the actual link to the resource monitor

                            QProcess::startDetached("C:\\Program Files (x86)\IObit\Advanced SystemCare Ultimate\Monitor.exe");
                            

                            And yes, I put a shortcut in C: and also in system 32, so that I could try using it both ways:

                            QProcess::startDetached("C:\\Monitor.exe");
                            
                            QProcess::startDetached("Monitor.exe");
                            

                            Trying all three above shows no errors, but won't work either :(

                            Be Blessed!
                            Epiales666

                            mrjjM 1 Reply Last reply
                            0
                            • Epiales666E Epiales666

                              @mrjj said in Run At Startup:

                              @Epiales666

                              im pretty sure it just needs some extra dlls.
                              Did you just take it from its installation folder and
                              put alone in c:\ ?
                              and u did use 2 backslashes ?

                              c:\\xx.exe <-- 2 in code
                              

                              Is it a public free one i could also download?

                              Okay, here is the actual link to the resource monitor

                              QProcess::startDetached("C:\\Program Files (x86)\IObit\Advanced SystemCare Ultimate\Monitor.exe");
                              

                              And yes, I put a shortcut in C: and also in system 32, so that I could try using it both ways:

                              QProcess::startDetached("C:\\Monitor.exe");
                              
                              QProcess::startDetached("Monitor.exe");
                              

                              Trying all three above shows no errors, but won't work either :(

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by mrjj
                              #14

                              Hi
                              I do not think you can just copy monitor alone.
                              that is the error. i guess it has dlls in its folder, which are NOT found when running it
                              with QProcess since they are in other folder.

                              for this line

                              QProcess::startDetached("C:\\Program Files (x86)\IObit\Advanced SystemCare Ultimate\Monitor.exe");
                              did you escape all slashes ?
                              also it might not like the spaces unless you put "" around 
                              

                              like this

                              QProcess::startDetached("\"C:\\Program Files (x86)\\Windows Photo Viewer\\ImagingDevices.exe\"");
                              

                              this starts the app.

                              Epiales666E 1 Reply Last reply
                              1
                              • mrjjM mrjj

                                Hi
                                I do not think you can just copy monitor alone.
                                that is the error. i guess it has dlls in its folder, which are NOT found when running it
                                with QProcess since they are in other folder.

                                for this line

                                QProcess::startDetached("C:\\Program Files (x86)\IObit\Advanced SystemCare Ultimate\Monitor.exe");
                                did you escape all slashes ?
                                also it might not like the spaces unless you put "" around 
                                

                                like this

                                QProcess::startDetached("\"C:\\Program Files (x86)\\Windows Photo Viewer\\ImagingDevices.exe\"");
                                

                                this starts the app.

                                Epiales666E Offline
                                Epiales666E Offline
                                Epiales666
                                wrote on last edited by
                                #15

                                @mrjj

                                Yeah, I've tried that way as well... my newest attempts are:

                                QProcess *process = new QProcess(this);
                                QString monitor="\"C:\\Monitor.exe\"";
                                process->startDetached(monitor);
                                

                                AND

                                QProcess::startDetached("\"C:\\Program Files (x86)\\IObit\\Advanced SystemCare Ultimate\\Monitor.exe\"");
                                

                                Neither one of them work either. Grrrrr Your example works fine. It opens correctly... what am I doing wrong?

                                Be Blessed!
                                Epiales666

                                mrjjM 1 Reply Last reply
                                0
                                • Epiales666E Epiales666

                                  @mrjj

                                  Yeah, I've tried that way as well... my newest attempts are:

                                  QProcess *process = new QProcess(this);
                                  QString monitor="\"C:\\Monitor.exe\"";
                                  process->startDetached(monitor);
                                  

                                  AND

                                  QProcess::startDetached("\"C:\\Program Files (x86)\\IObit\\Advanced SystemCare Ultimate\\Monitor.exe\"");
                                  

                                  Neither one of them work either. Grrrrr Your example works fine. It opens correctly... what am I doing wrong?

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @Epiales666
                                  I guess that Monitor.exe dont like to be started like that :)
                                  Im not sure what environment QProcess starts with. if copy of default
                                  or a reduced one. In any case, i think Monitor.exe tried to load something in dont find when started like that.

                                  Epiales666E 1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @Epiales666
                                    I guess that Monitor.exe dont like to be started like that :)
                                    Im not sure what environment QProcess starts with. if copy of default
                                    or a reduced one. In any case, i think Monitor.exe tried to load something in dont find when started like that.

                                    Epiales666E Offline
                                    Epiales666E Offline
                                    Epiales666
                                    wrote on last edited by
                                    #17

                                    @mrjj said in Run At Startup:

                                    @Epiales666
                                    I guess that Monitor.exe dont like to be started like that :)
                                    Im not sure what environment QProcess starts with. if copy of default
                                    or a reduced one. In any case, i think Monitor.exe tried to load something in dont find when started like that.

                                    Yeah, I can do variants of

                                    QProcess *process = new QProcess(this);
                                    QString monitor="\"C:\Monitor.exe\"";
                                    process->startDetached(monitor);
                                    

                                    And it will work. Like if I put in the address for internet explorer, it works fine. So does the example you gave me... But it doesn't seem to like Monitor.exe for whatever reason. Frustrating. It shouldn't matter what exe it is. It should open regardless.

                                    Anyway, thank you for your help. I'll still mess around with other variants and see if I can't get something to work.

                                    Be Blessed!
                                    Epiales666

                                    mrjjM 1 Reply Last reply
                                    0
                                    • Epiales666E Epiales666

                                      @mrjj said in Run At Startup:

                                      @Epiales666
                                      I guess that Monitor.exe dont like to be started like that :)
                                      Im not sure what environment QProcess starts with. if copy of default
                                      or a reduced one. In any case, i think Monitor.exe tried to load something in dont find when started like that.

                                      Yeah, I can do variants of

                                      QProcess *process = new QProcess(this);
                                      QString monitor="\"C:\Monitor.exe\"";
                                      process->startDetached(monitor);
                                      

                                      And it will work. Like if I put in the address for internet explorer, it works fine. So does the example you gave me... But it doesn't seem to like Monitor.exe for whatever reason. Frustrating. It shouldn't matter what exe it is. It should open regardless.

                                      Anyway, thank you for your help. I'll still mess around with other variants and see if I can't get something to work.

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by mrjj
                                      #18

                                      @Epiales666 said in Run At Startup:

                                      what exe it is. It should open regardless.

                                      No, that really is not the case.
                                      if it has some path set in ENVIRONMENT it uses for data or loads dlls directly from subfolder next to exe, it
                                      wont work as QProcess might not have
                                      same setup in ENVIRONMENT. ( i dont know if true or false)

                                      Also if this one
                                      "Advanced SystemCare Ultimate 10 is a powerful and full-scale software for PC security"
                                      It might detect it as tampering and hence do not start.

                                      Epiales666E 3 Replies Last reply
                                      1
                                      • mrjjM mrjj

                                        @Epiales666 said in Run At Startup:

                                        what exe it is. It should open regardless.

                                        No, that really is not the case.
                                        if it has some path set in ENVIRONMENT it uses for data or loads dlls directly from subfolder next to exe, it
                                        wont work as QProcess might not have
                                        same setup in ENVIRONMENT. ( i dont know if true or false)

                                        Also if this one
                                        "Advanced SystemCare Ultimate 10 is a powerful and full-scale software for PC security"
                                        It might detect it as tampering and hence do not start.

                                        Epiales666E Offline
                                        Epiales666E Offline
                                        Epiales666
                                        wrote on last edited by
                                        #19

                                        @mrjj

                                        Thank you very much for your help. I'm going to go ahead and classify this topic as solved, since there is no work around to doing what I'd like to do. You were an extremely helpful person. I'll go back and add to your reputation. Thank you much

                                        Be Blessed!
                                        Epiales666

                                        1 Reply Last reply
                                        1
                                        • mrjjM mrjj

                                          @Epiales666 said in Run At Startup:

                                          what exe it is. It should open regardless.

                                          No, that really is not the case.
                                          if it has some path set in ENVIRONMENT it uses for data or loads dlls directly from subfolder next to exe, it
                                          wont work as QProcess might not have
                                          same setup in ENVIRONMENT. ( i dont know if true or false)

                                          Also if this one
                                          "Advanced SystemCare Ultimate 10 is a powerful and full-scale software for PC security"
                                          It might detect it as tampering and hence do not start.

                                          Epiales666E Offline
                                          Epiales666E Offline
                                          Epiales666
                                          wrote on last edited by
                                          #20

                                          @mrjj

                                          So you know, I solved the problem by doing the below:

                                          QDesktopServices::openUrl(QUrl("file:///C:/Program Files (x86)/IObit/Advanced SystemCare Ultimate/Monitor.exe", QUrl::TolerantMode));
                                          

                                          Only issue is I don't know how to place it to a particular spot on my system. I have a blank table set inside my program so that I can move it right into that spot and it looks lke it's part of the program lol... so just have to figure out how to move it to x and y position so that it starts there along with the program at startup.

                                          But wanted to let you know there was a work around to get it to start when system boots. Again, thanks for your help.

                                          Be Blessed!
                                          Epiales666

                                          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