c++ - How to hide the console of a process given its PID? -
i start process when click on button on qt application. created process qprocess::startdetached(..., qint64 * pid) (http://doc.qt.io/qt-5/qprocess.html#startdetached) have console hide.
how hide it? function must use outside process?
this code doesn't hide console of process (in win32):
if (attachconsole((dword)m_pid)) { freeconsole(); }
if can recompile program starting, might make windows rather console program (in msvc in projects linker->system, settings, want /subsystem:windows).
else qt start method apparently never creates console window, while startdetached does, might possible use start depending on use.
alternatively create_no_window flag createprocess prevent automatic console, quote msdn:
the process console application being run without console window. therefore, console handle application not set.
unfortunately not qt provides way create or use qprocess native flags or native handle (e.g. no qprocess process(createprocess(...))), allthough suggest years , rejected. qprocess: make possible set native process creating flags
so either have use microsoft api's or find library multi-process work.
Comments
Post a Comment