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
Forum Updated to NodeBB v4.3 + New Features

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.6k Views 3 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.
  • PunitP Offline
    PunitP Offline
    Punit
    wrote on last edited by Punit
    #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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      • PunitP Offline
        PunitP Offline
        Punit
        wrote on 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!

        kshegunovK 1 Reply Last reply
        0
        • PunitP Punit

          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!

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on 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

          the_T 1 Reply Last reply
          1
          • kshegunovK kshegunov

            @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?

            the_T Offline
            the_T Offline
            the_
            wrote on last edited by
            #5

            @kshegunov

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

            -- No support in PM --

            kshegunovK 1 Reply Last reply
            2
            • the_T the_

              @kshegunov

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

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #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

              the_T 1 Reply Last reply
              1
              • kshegunovK kshegunov

                @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 ... :)

                the_T Offline
                the_T Offline
                the_
                wrote on last edited by
                #7

                @kshegunov

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

                -- No support in PM --

                kshegunovK 1 Reply Last reply
                0
                • the_T the_

                  @kshegunov

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

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #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
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 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

                    • Login

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