How to safely close external program like "VLC" from QT
-
wrote on 6 Jun 2016, 08:21 last edited by Punit 6 Jun 2016, 08:22
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.
-
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 ?
-
wrote on 9 Jun 2016, 05:18 last edited by
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!
-
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!
@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?
-
@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?
wrote on 9 Jun 2016, 13:57 last edited byThe only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)
-
The only functions/methods i know are TerminateProcess (MSDN) or taskkill called from commandline :)
Moderatorswrote on 9 Jun 2016, 16:19 last edited by kshegunov 6 Sept 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 ... :)
-
@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 ... :)
wrote on 9 Jun 2016, 16:37 last edited byI did not say anything about save or graceful or something like that ;)
-
I did not say anything about save or graceful or something like that ;)
Moderatorswrote on 9 Jun 2016, 16:41 last edited by kshegunov 6 Sept 2016, 16:42I did not say anything about save or graceful or something like that
True. Whence my original question ... :)
-
One thing to add to @kshegunov, terminating these applications ungracefully may have side effects on the stability of your system.
7/9