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. close/kill another Windows process which is started by run a .bat in Qt app
Forum Updated to NodeBB v4.3 + New Features

close/kill another Windows process which is started by run a .bat in Qt app

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 1.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.
  • jsulmJ jsulm

    You can run this command without cmd.exe, that's my point...

    V Offline
    V Offline
    Vijaykarthikeyan
    wrote on last edited by
    #10

    @jsulm With the help of GStreamer Library?

    JonBJ 1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #11

      No.

      process->start("gst-launch-1.0", QStringList() << HERE_PUT_THE_PARAMETERS_AS_LIST);
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • V Vijaykarthikeyan

        @jsulm With the help of GStreamer Library?

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

        @Vijaykarthikeyan
        Don't understand. @jsulm is just asking why you use cmd /c ... at all? Use QProcess::startCommand() directly on your string starting with "gst-launch-1.0 ...". Then you don't have a cmd process and a gst-launch-1.0 one to deal with.

        @jsulm
        The user probably doesn't want to split his string into lots of separate arguments to pass to start() :) That's why I suggest he might want to use startCommand().

        V 2 Replies Last reply
        1
        • JonBJ JonB

          @Vijaykarthikeyan
          Don't understand. @jsulm is just asking why you use cmd /c ... at all? Use QProcess::startCommand() directly on your string starting with "gst-launch-1.0 ...". Then you don't have a cmd process and a gst-launch-1.0 one to deal with.

          @jsulm
          The user probably doesn't want to split his string into lots of separate arguments to pass to start() :) That's why I suggest he might want to use startCommand().

          V Offline
          V Offline
          Vijaykarthikeyan
          wrote on last edited by
          #13

          @JonB Oh..sorry..actually..I dont know about startcommand() until now..I'll try it and feedback you

          1 Reply Last reply
          0
          • JonBJ JonB

            @Vijaykarthikeyan
            Don't understand. @jsulm is just asking why you use cmd /c ... at all? Use QProcess::startCommand() directly on your string starting with "gst-launch-1.0 ...". Then you don't have a cmd process and a gst-launch-1.0 one to deal with.

            @jsulm
            The user probably doesn't want to split his string into lots of separate arguments to pass to start() :) That's why I suggest he might want to use startCommand().

            V Offline
            V Offline
            Vijaykarthikeyan
            wrote on last edited by
            #14

            @JonB Sorry to interrupt you..Just now gone throught that documentation,this startCommand() method is available for the Qt versions 6.x but I'm using 5.15.2.

            that's why i didnt know about this command

            1 Reply Last reply
            0
            • JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #15

              Always helps if you tells which version you are using for any question!

              To use start() then (without cmd /c) you must chop your line up into separate arguments at every (non-embedded) space. probably including each of those ! which are being used as "pipes" on the command passed to gst-launch-1.0. Do so manually in code source, or maybe use QString::split() on space if you want. I think QStringList QProcess::splitCommand(QStringView command) is available to you in 5.15. [Yes, it was introduced at 5.15 if you want to use it.]

              V 1 Reply Last reply
              2
              • JonBJ JonB

                Always helps if you tells which version you are using for any question!

                To use start() then (without cmd /c) you must chop your line up into separate arguments at every (non-embedded) space. probably including each of those ! which are being used as "pipes" on the command passed to gst-launch-1.0. Do so manually in code source, or maybe use QString::split() on space if you want. I think QStringList QProcess::splitCommand(QStringView command) is available to you in 5.15. [Yes, it was introduced at 5.15 if you want to use it.]

                V Offline
                V Offline
                Vijaykarthikeyan
                wrote on last edited by
                #16

                @JonB Ok..Running..But..when process->kill() executed..it is not closing that process.Why? How to close it by process->processId()

                1 Reply Last reply
                0
                • JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #17

                  Why? I don't know.
                  Windows/DOS has a taskkill <pid> command, I believe. You could issue that via another QProcess (try it first from command line). I don't know if that will work when QProcess::kill() does not. I do not know whether gst-launch-1.0 is itself a "wrapper" for spawning other processes.

                  V 1 Reply Last reply
                  1
                  • JonBJ JonB

                    Why? I don't know.
                    Windows/DOS has a taskkill <pid> command, I believe. You could issue that via another QProcess (try it first from command line). I don't know if that will work when QProcess::kill() does not. I do not know whether gst-launch-1.0 is itself a "wrapper" for spawning other processes.

                    V Offline
                    V Offline
                    Vijaykarthikeyan
                    wrote on last edited by
                    #18

                    @JonB ok..understand..Can you please calrify one thing.. Will terminatinf the QProcess will terminate the process pointer or the process which is triggered by the QProcess?

                    JonBJ 1 Reply Last reply
                    0
                    • V Vijaykarthikeyan

                      @JonB ok..understand..Can you please calrify one thing.. Will terminatinf the QProcess will terminate the process pointer or the process which is triggered by the QProcess?

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

                      @Vijaykarthikeyan It should delete terminate the process created on the QProcess object, i.e. just what you would expect.

                      1 Reply Last reply
                      1

                      • Login

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