Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

QProcess::terminate can not stop Windows console application with SetConsoleCtrlHandler

$
0
0
I try to control Windows non-Qt console application from Qt desktop application. Qt documentation says, that on Windows QProcess::terminate posts WM_CLOSE message. MSDN says that WM_CLOSE message is translated to CTRL_CLOSE_EVENT for console application. So, in console application I call WinAPI function SetConsoleCtrlHandler, after that the application successfully intercept events like CTRL-C press (CTRL_C_EVENT) and Alt-F4 press (CTRL_CLOSE_EVENT). From Qt application I successfully start console application using QProcess. Then I wait for application started using waitForStarted and try to gentle finish him using QProcess::terminate method, but nothing happens. In the same time QProcess kill works as expected. What should I change in the console application or Qt application to receive event from QProcess::terminate?

Viewing all articles
Browse latest Browse all 22112


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>