QApplication - exec() in Windows Service



  • Hello,

    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:
    @
    QApplication *a;
    int Main(...)
    {
    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)
    return 0;
    }

    void WINAPI ServiceMain(DWORD argc, LPTSTR *argv)
    {
    do some stuff
    //start QThread .... it works
    // a->exec();
    while(serviceRun)
    {
    }
    }
    @

    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...



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.