Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QApplication - exec() in Windows Service
mr_einsa last edited by
i created a Windows Service, without QService... is it possible to add the exec Command?
I go into the Service, create the Gui ... all done but if i try in my ServiceMain funktion to do a.exec() it fails. Here is some Code:
Gui_class *gc = new Gui_class; //here is the gui createt and it works
//some connect(); funktions
//some winService code
//call ServiceMain(DWORD argc, LPTSTR *argv)
void WINAPI ServiceMain(DWORD argc, LPTSTR *argv)
do some stuff
//start QThread .... it works
The Problem now is if some signals from the tread comes, the gui didnt execute. But my code is correct because it work without the windows service.
If i return the a->exec(), in the main funktion it works but only if the service is shutting down...
Please help me i have to implement the Gui in the service ... is there a way?
Thank you for your time...
lgeyer last edited by
I'm not quite sure if I got your question correctly, but Windows services use a non-interactive window station, thus cannot have a user interface. You will have to use QCoreApplication instead.