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. QProcess starting separate Qt application based on QWidget class
Qt 6.11 is out! See what's new in the release blog

QProcess starting separate Qt application based on QWidget class

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 5 Posters 5.4k 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.
  • J Jendker

    @Taz742
    If I understand your post properly: yes, the path is correct, the file is created in the given directory, but it reamains empty after running the program.

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

    @Jendker
    Hi
    If you go to the location of the application and click it.
    Does it then start normally ?

    J 1 Reply Last reply
    0
    • mrjjM mrjj

      @Jendker
      Hi
      If you go to the location of the application and click it.
      Does it then start normally ?

      J Offline
      J Offline
      Jendker
      wrote on last edited by Jendker
      #9

      @mrjj
      Hi
      Yes, it does start without any problems.

      Do give you some details which may be relevant:

      • the child process has subsystem: Windows defined and is written with VS Tools Plugin
      • I am starting the parent with the console in the following way (as I am working in VS):
      #ifdef DEBUG
      	// detach from the current console window
      	// if launched from a console window, that will still run waiting for the new console (below) to close
      	// it is useful to detach from Qt Creator's <Application output> panel
      	FreeConsole();
      
      	// create a separate new console window
      	AllocConsole();
      
      	// attach the new console to this application's process
      	AttachConsole(GetCurrentProcessId());
      
      	// reopen the std I/O streams to redirect I/O to the new console
      	freopen("CON", "w", stdout);
      	freopen("CON", "w", stderr);
      	freopen("CON", "r", stdin);
      #endif
      

      And was trying to start the child with such console activated and not, it did not make any difference, the window did not appear.

      mrjjM 1 Reply Last reply
      0
      • J Jendker

        @mrjj
        Hi
        Yes, it does start without any problems.

        Do give you some details which may be relevant:

        • the child process has subsystem: Windows defined and is written with VS Tools Plugin
        • I am starting the parent with the console in the following way (as I am working in VS):
        #ifdef DEBUG
        	// detach from the current console window
        	// if launched from a console window, that will still run waiting for the new console (below) to close
        	// it is useful to detach from Qt Creator's <Application output> panel
        	FreeConsole();
        
        	// create a separate new console window
        	AllocConsole();
        
        	// attach the new console to this application's process
        	AttachConsole(GetCurrentProcessId());
        
        	// reopen the std I/O streams to redirect I/O to the new console
        	freopen("CON", "w", stdout);
        	freopen("CON", "w", stderr);
        	freopen("CON", "r", stdin);
        #endif
        

        And was trying to start the child with such console activated and not, it did not make any difference, the window did not appear.

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

        @Jendker said in QProcess starting separate Qt application based on QWidget class:

        , the window did not appear.

        Window being a console (cmd) window ?

        J 1 Reply Last reply
        0
        • mrjjM mrjj

          @Jendker said in QProcess starting separate Qt application based on QWidget class:

          , the window did not appear.

          Window being a console (cmd) window ?

          J Offline
          J Offline
          Jendker
          wrote on last edited by Jendker
          #11

          @mrjj
          No, the child is the QtWidget class based application, I was trying to start it with start() and startDetached() and the appplication only appeared in Task Manager in both cases. When I start it manually it works without any problems.

          mrjjM 1 Reply Last reply
          0
          • J Jendker

            @mrjj
            No, the child is the QtWidget class based application, I was trying to start it with start() and startDetached() and the appplication only appeared in Task Manager in both cases. When I start it manually it works without any problems.

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

            @Jendker
            it must be something simple then.
            The program you trying to start do have a complete deployment folder with all needed Dlls?

            J 1 Reply Last reply
            0
            • mrjjM mrjj

              @Jendker
              it must be something simple then.
              The program you trying to start do have a complete deployment folder with all needed Dlls?

              J Offline
              J Offline
              Jendker
              wrote on last edited by Jendker
              #13

              @mrjj
              Yes, it does start without any problem when I am doing it manually. I guess that means, that it has all needed Dlls?

              I tested and simple console Hello World program is writing to the output file without any problem, but the child QtWidget program which has also std output does not write anything to the file. The problem is that, the program does not terminate, as it is working in loop and is being destroyed before the termination when closing parent application (when starting with start() ). Maybe because of it it does not even write anything to the output file?

              EDIT: It is possible that I found the issue, please just let me work on it for now to check it.

              EDIT2: Yes, it seems, that when I was starting the parent, there was something wrong with semaphore what was blocking the other application to start... I was trying to port the standard C++ project (where it was working fine) to Qt and it seems that I messed something up with it. Sorry for the confusion, if I will have any further problems with it, let me continue to ask in this topic.

              mrjjM 1 Reply Last reply
              0
              • J Jendker

                @mrjj
                Yes, it does start without any problem when I am doing it manually. I guess that means, that it has all needed Dlls?

                I tested and simple console Hello World program is writing to the output file without any problem, but the child QtWidget program which has also std output does not write anything to the file. The problem is that, the program does not terminate, as it is working in loop and is being destroyed before the termination when closing parent application (when starting with start() ). Maybe because of it it does not even write anything to the output file?

                EDIT: It is possible that I found the issue, please just let me work on it for now to check it.

                EDIT2: Yes, it seems, that when I was starting the parent, there was something wrong with semaphore what was blocking the other application to start... I was trying to port the standard C++ project (where it was working fine) to Qt and it seems that I messed something up with it. Sorry for the confusion, if I will have any further problems with it, let me continue to ask in this topic.

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

                @Jendker said in QProcess starting separate Qt application based on QWidget class:
                Super. I cross fingers you found it.

                . Maybe because of it it does not even write anything to the output file?

                Do you call flush from time to time on the file?
                Else yes, if it dont terminate , it might never flush/write to the file.

                I guess that means, that it has all needed Dlls?

                You can check that by renaming the Qt folder and then try to start it.
                This way it must use its included dlls and not the one it can find in the Qt folder.

                J 1 Reply Last reply
                2
                • mrjjM mrjj

                  @Jendker said in QProcess starting separate Qt application based on QWidget class:
                  Super. I cross fingers you found it.

                  . Maybe because of it it does not even write anything to the output file?

                  Do you call flush from time to time on the file?
                  Else yes, if it dont terminate , it might never flush/write to the file.

                  I guess that means, that it has all needed Dlls?

                  You can check that by renaming the Qt folder and then try to start it.
                  This way it must use its included dlls and not the one it can find in the Qt folder.

                  J Offline
                  J Offline
                  Jendker
                  wrote on last edited by
                  #15

                  @mrjj
                  Thank your for your input :) My case is solved, therefore I match question as answered.

                  J 1 Reply Last reply
                  1
                  • J Jendker

                    @mrjj
                    Thank your for your input :) My case is solved, therefore I match question as answered.

                    J Offline
                    J Offline
                    Juampa
                    wrote on last edited by
                    #16

                    @Jendker I would be nice from you to explain how was resolved.

                    mrjjM 1 Reply Last reply
                    0
                    • J Juampa

                      @Jendker I would be nice from you to explain how was resolved.

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

                      @Juampa
                      Hi and welcome the forums.
                      Which part of the pretty long post ?
                      You try start a Qt application with Process ?

                      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