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 15.3k 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 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
                        • 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
                          #21

                          @mrjj

                          So you can see what I'm talking about...

                          https://gyazo.com/b225e65df38e57dafea62e680349089c

                          See the Ram and CPU at the top? That's the Monitor.exe.... I just either need to move it to x and y position, or somehow place it WITHIN the app so that it shows there...don't know how to do either lol. I used the:

                          setGeometry(1510, 30, 10,10);
                          

                          For the app location, but not sure how to do that one. Thanks!

                          Be Blessed!
                          Epiales666

                          mrjjM 1 Reply Last reply
                          0
                          • Epiales666E Epiales666

                            @mrjj

                            So you can see what I'm talking about...

                            https://gyazo.com/b225e65df38e57dafea62e680349089c

                            See the Ram and CPU at the top? That's the Monitor.exe.... I just either need to move it to x and y position, or somehow place it WITHIN the app so that it shows there...don't know how to do either lol. I used the:

                            setGeometry(1510, 30, 10,10);
                            

                            For the app location, but not sure how to do that one. Thanks!

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

                            @Epiales666
                            Hi
                            Cool launcher :)
                            I think its sadly not possible to embed monitor into your app.
                            But you should be able to move it but to control it, i think you need native windows api.

                            Update
                            Why not get the values your self?
                            https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process

                            Epiales666E 1 Reply Last reply
                            1
                            • Epiales666E Epiales666

                              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!

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by JonB
                              #23

                              @Epiales666
                              You want to run an external program.
                              From your (Qt) app you can cause that program to launch, just like however you run it now without any app.
                              You cannot make that other program's windows or whatever be a part of your program's windows, or control its windows, such that it is embedded in your Qt app.

                              Epiales666E 1 Reply Last reply
                              1
                              • mrjjM mrjj

                                @Epiales666
                                Hi
                                Cool launcher :)
                                I think its sadly not possible to embed monitor into your app.
                                But you should be able to move it but to control it, i think you need native windows api.

                                Update
                                Why not get the values your self?
                                https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process

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

                                @mrjj

                                Oh nice. I have that bookmarked. Will definitely think about trying to do that. Thank you!

                                Be Blessed!
                                Epiales666

                                1 Reply Last reply
                                0
                                • JonBJ JonB

                                  @Epiales666
                                  You want to run an external program.
                                  From your (Qt) app you can cause that program to launch, just like however you run it now without any app.
                                  You cannot make that other program's windows or whatever be a part of your program's windows, or control its windows, such that it is embedded in your Qt app.

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

                                  @JNBarchan

                                  Yeah, I didn't think it possible to embed it into the program. As you read above, we had a problem getting it to even run at all outside the program. I fixed that today thank goodness. And yeah, wouldn't be anyway to even operate it if it were embeded. I just will figure out how to move it 'INTO' the table I have in my program. Or should I say, move it OVER my app to make it appear to be inside it lol. Thanks for taking the time to reply. I really do appreciate it.

                                  Be Blessed!
                                  Epiales666

                                  JonBJ 1 Reply Last reply
                                  0
                                  • Epiales666E Epiales666

                                    @JNBarchan

                                    Yeah, I didn't think it possible to embed it into the program. As you read above, we had a problem getting it to even run at all outside the program. I fixed that today thank goodness. And yeah, wouldn't be anyway to even operate it if it were embeded. I just will figure out how to move it 'INTO' the table I have in my program. Or should I say, move it OVER my app to make it appear to be inside it lol. Thanks for taking the time to reply. I really do appreciate it.

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #26

                                    @Epiales666 said in Run At Startup:

                                    @JNBarchan

                                    I just will figure out how to move it 'INTO' the table I have in my program. Or should I say, move it OVER my app to make it appear to be inside it lol.

                                    That is likely to prove difficult. Since it will only be "over" your app, if, say, your app's window is moved the resource monitor will not move with it. Further, because of the "over" you may find window up-front problems, or when over it may block interaction with your app, depending on how the monitor behaves. You will not find a robust solution this way, just saying.

                                    Epiales666E 1 Reply Last reply
                                    1
                                    • JonBJ JonB

                                      @Epiales666 said in Run At Startup:

                                      @JNBarchan

                                      I just will figure out how to move it 'INTO' the table I have in my program. Or should I say, move it OVER my app to make it appear to be inside it lol.

                                      That is likely to prove difficult. Since it will only be "over" your app, if, say, your app's window is moved the resource monitor will not move with it. Further, because of the "over" you may find window up-front problems, or when over it may block interaction with your app, depending on how the monitor behaves. You will not find a robust solution this way, just saying.

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

                                      @JNBarchan

                                      Yeah, I have it always on top for both of them, and it does stay right in the area at the top of my application. It doesn't fall behind it or anything. I set my app to show at the far right top of my screen to be away from anything I"m doing. My internet browser and screen is big enough that I don't have to have it full screen, so I always see my app. It works for me pretty well, as my screen is large enough. I do think, however, I'm going to look into the link that @mrjj posted above, and see about putting them inside the app.

                                      Be Blessed!
                                      Epiales666

                                      JonBJ 1 Reply Last reply
                                      0
                                      • Epiales666E Epiales666

                                        @JNBarchan

                                        Yeah, I have it always on top for both of them, and it does stay right in the area at the top of my application. It doesn't fall behind it or anything. I set my app to show at the far right top of my screen to be away from anything I"m doing. My internet browser and screen is big enough that I don't have to have it full screen, so I always see my app. It works for me pretty well, as my screen is large enough. I do think, however, I'm going to look into the link that @mrjj posted above, and see about putting them inside the app.

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by
                                        #28

                                        @Epiales666
                                        If it works for you personally that's fine :)

                                        To avoid separate-process/windows issues, you need either @mrjj 's solution of you write your own (Qt) application to display the data, or you find something like a resource monitor "component" which is for embedding in your code. I would Google for that first.

                                        1 Reply Last reply
                                        2

                                        • Login

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