+ Reply to Thread
Results 1 to 5 of 5

Thread: QtService example interactive not running

  1. #1
    Join Date
    Mar 2014
    Location
    USA
    Posts
    50
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default QtService example interactive not running

    I'm creating a qtservice that has a gui for doing log in/log out. I modeled it after the example "interactive" in the examples folder. Instead of QLabel I use a gui I wrote. It won't run. When I try to start it the process shows up in the process list, but it time outs. I tried running the interactive example in the qtservices folder which is supposed to show a QLabel with "Service" as the text. The service installs (-i), the service starts (-s) and shows that it is running and the process is there in the process list, but there's no label. What in the heck could I be doing wrong that even the example doesn't run? I'm running in Administration window.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,650
    Thanks
    211
    Thanked 560 Times in 550 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtService example interactive not running

    What in the heck could I be doing wrong that even the example doesn't run?
    Having a bad month, maybe?

    I have never messed with trying to create and Windows service. I'm wondering if you could find a non-Qt service example, maybe on the MSDN site (like this one), that you could get working. Services normally run without a GUI, so I also wonder if there is a flag you are missing in the command line that says "run interactively", and without it, you get a background process.

    But then there are these lines from the Qt Solutions QtService "interactive" example:

    Qt Code:
    1. void InteractiveService::start()
    2. {
    3. #if defined(Q_OS_WIN)
    4. if ((QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) &&
    5. (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)) {
    6. logMessage( "Service GUI not allowed on Windows Vista. See the documentation for this example for more information.", QtServiceBase::Error );
    7. return;
    8. }
    9. #endif
    To copy to clipboard, switch view to plain text mode 

    Windows 7 and 10 certainly pass the >= WV_VISTA test, so you'll see a log message and no GUI.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. The following user says thank you to d_stranz for this useful post:

    TonyInSoMD (13th March 2018)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,476
    Thanks
    13
    Thanked 1,565 Times in 1,495 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QtService example interactive not running

    You will need at least one other option on the service for this to have a chance of working:
    • Install the service
    • Open the services panel
    • Go to the service properties page
    • Click on the "Log On" tab
    • Select "Local System account"
    • Check "Allow service to interact with desktop"


    More here at Stack Overflow
    “We can't solve problems by using the same kind of thinking we used when we created them.” -- Einstein

    If you are posting code then please use [code] [/code] tags around it. The forum will link class names to docs, add syntax highlighting, and won't mangle your code. Above all, it makes your question easier to address.

  5. The following user says thank you to ChrisW67 for this useful post:

    TonyInSoMD (13th March 2018)

  6. #4
    Join Date
    Mar 2014
    Location
    USA
    Posts
    50
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QtService example interactive not running

    The settings were already like that. Like d_stranz pointed out, you can't use interactive service (the one I need) on Windows 7 soon to be 10. Sorry I missed that, I skimmed over that part and thought it said != instead of =>. I guess I should actually pay attention to what I read.

  7. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,650
    Thanks
    211
    Thanked 560 Times in 550 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtService example interactive not running

    you can't use interactive service (the one I need)
    So you might have to be a bit more creative. Implement your service with a port of some sort you can connect to via a non-service GUI client. When the client runs, it connects to this port to send commands to the service. Qt has many options for interprocess communication, pick one that works best for your situation.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

+ Reply to Thread

Similar Threads

  1. interactive design
    By pedro74 in forum Qt Programming
    Replies: 3
    Last Post: 10th September 2016, 18:42
  2. Interactive graphics in Qt
    By wconstan in forum Newbie
    Replies: 2
    Last Post: 15th December 2010, 20:51
  3. Replies: 0
    Last Post: 1st May 2010, 12:41
  4. QtService on Windows as Non-Interactive
    By stefanadelbert in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2010, 03:27
  5. qsqlquery interactive?
    By lamera in forum Newbie
    Replies: 2
    Last Post: 7th September 2008, 10:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts