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. How to safely close external program like "VLC" from QT
QtWS25 Last Chance

How to safely close external program like "VLC" from QT

Scheduled Pinned Locked Moved Solved General and Desktop
qt5.6qprocessclose programexternal applickill
9 Posts 4 Posters 3.5k Views
  • 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.
  • P Offline
    P Offline
    Punit
    wrote on 6 Jun 2016, 08:21 last edited by Punit 6 Jun 2016, 08:22
    #1

    i need to close external application currently running on my system from QT. (Like "VLC", "Virtual DJ") etc. [work on Windows and Linux both ]

    I searched and finally found Qprocess. I am searching for an example or tutorial to show me how to close external programs, but I am unable to find any solution. I am a newbie , so can anyone help me Please or show me a demo?

    Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Jun 2016, 22:38 last edited by
      #2

      Hi,

      Are you starting these application from your own application ? If so how are you doing it ?

      Out of curiosity, why do you need such a feature ?

      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
      1
      • P Offline
        P Offline
        Punit
        wrote on 9 Jun 2016, 05:18 last edited by
        #3

        Hello @SGaist

        I have resolved this issue. But, It's good to see that there is someone who is always ready to help everyone. Thanks for your suggestions and support. :)

        Now, Actually In my application, I can close any running external program selected from a drop down list .

        For this I have created a method to get PID (Work for both windows and linux)

        QString My::getProcessIdsByProcessName(const char* processName, QStringList &Pids)
        {

        //code
        }

        and after getting PID's, I call appropriate function to close a particular application.

        Thanks!

        K 1 Reply Last reply 9 Jun 2016, 12:17
        0
        • P Punit
          9 Jun 2016, 05:18

          Hello @SGaist

          I have resolved this issue. But, It's good to see that there is someone who is always ready to help everyone. Thanks for your suggestions and support. :)

          Now, Actually In my application, I can close any running external program selected from a drop down list .

          For this I have created a method to get PID (Work for both windows and linux)

          QString My::getProcessIdsByProcessName(const char* processName, QStringList &Pids)
          {

          //code
          }

          and after getting PID's, I call appropriate function to close a particular application.

          Thanks!

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 9 Jun 2016, 12:17 last edited by
          #4

          @Punit said:

          and after getting PID's, I call appropriate function to close a particular application.

          I'm curious as to what that function might be?

          Read and abide by the Qt Code of Conduct

          T 1 Reply Last reply 9 Jun 2016, 13:57
          1
          • K kshegunov
            9 Jun 2016, 12:17

            @Punit said:

            and after getting PID's, I call appropriate function to close a particular application.

            I'm curious as to what that function might be?

            T Offline
            T Offline
            the_
            wrote on 9 Jun 2016, 13:57 last edited by
            #5

            @kshegunov

            The only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)

            -- No support in PM --

            K 1 Reply Last reply 9 Jun 2016, 16:19
            2
            • T the_
              9 Jun 2016, 13:57

              @kshegunov

              The only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 9 Jun 2016, 16:19 last edited by kshegunov 6 Sept 2016, 16:19
              #6

              @the_ said:

              The only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)

              Me too. But I wouldn't call those safe (in the sense of the thread's topic), nor graceful ... :)

              Read and abide by the Qt Code of Conduct

              T 1 Reply Last reply 9 Jun 2016, 16:37
              1
              • K kshegunov
                9 Jun 2016, 16:19

                @the_ said:

                The only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)

                Me too. But I wouldn't call those safe (in the sense of the thread's topic), nor graceful ... :)

                T Offline
                T Offline
                the_
                wrote on 9 Jun 2016, 16:37 last edited by
                #7

                @kshegunov

                I did not say anything about save or graceful or something like that ;)

                -- No support in PM --

                K 1 Reply Last reply 9 Jun 2016, 16:41
                0
                • T the_
                  9 Jun 2016, 16:37

                  @kshegunov

                  I did not say anything about save or graceful or something like that ;)

                  K Offline
                  K Offline
                  kshegunov
                  Moderators
                  wrote on 9 Jun 2016, 16:41 last edited by kshegunov 6 Sept 2016, 16:42
                  #8

                  @the_

                  I did not say anything about save or graceful or something like that

                  True. Whence my original question ... :)

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  2
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 9 Jun 2016, 20:13 last edited by
                    #9

                    One thing to add to @kshegunov, terminating these applications ungracefully may have side effects on the stability of your system.

                    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
                    2

                    9/9

                    9 Jun 2016, 20:13

                    • Login

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