How to confirm whether some process is opened by process name?
-
My application opened one pcap file with wireshark with specify name.
I want to know how to confirm whether the process is opened by process name.
Process name examples:
pcap_file_2021-07-01-20-46-36.pcap
pcap_file_2021-07-01-20-20-01.pcap
.... -
@angelyouyou
You will need to use native calls for whatever your OS is to achieve this. -
I saved the QProcess pointer of the opened wireshark process, can I use it to judge whether the process is opened?
I open the wireshark process by StarDetached API, but
I can't confirm the process is running. -
@angelyouyou said in How to confirm whether some process is opened by process name?:
I want to know how to confirm whether the process is opened by process name.
If QProcess::startDetatched() returns true, then the process has started.
It also gives you the process ID (pid) if that is of use. -
@angelyouyou
You need to more specific about what exactly you are looking for/how these processes are started.If you are only interested in processes which you launched via Qt's
QProcess
you might check via PID instead of name. Or you can look atQProcess::program()
for each process. However, the examples you show do not look like the names of launchable processes, but who knows because you don't say what the program name(s) is/are when you launch them.I read your requirement as "Use OS-specific call to list the names of all running processes, and compare names against what I am looking for". Otherwise I don't know why you are interested in process names. But perhaps you do mean only processes your Qt app has launched, in which case I have indicated PID or maybe
QProcess::name()
is what you are interested in.