Results 1 to 7 of 7

Thread: how to start a service on computer startup.

  1. #1
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    22
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default how to start a service on computer startup.

    Hii,
    In my application I am writing a code that starts a particular service “for eg:- say MySql.” on computer startup….Can any 1 tel me how can i do this and using which Qt class, its possible..
    please help..

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to start a service on computer startup.

    This is OS dependent and normally hamdled by the OS. For example, on Windows you would install mySql as a service and it would be loaded on startup for you.

    Or do you mean you just want to load an application from within yours? If so, see QProcess

  3. #3
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    22
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to start a service on computer startup.

    I just want to add a checkbox in my application,such that on checking that checkbox the particular service should be started on windows startup and on unchecking the checkbox, the service should not start on windows startup..

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to start a service on computer startup.

    Typically you would use InstallUtil (http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx) which would request the OS installer tool to install your application as a service.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to start a service on computer startup.

    Your program will generally need administrator privilege to start/stop/modify Windows services.

    If all you want is for the user-space program to start when the user logs in then that is a different question that can be addressed by placing a shortcut into the user's Start Menu Programs/Startup folder (or Vista/Win7 equivalent)

  6. #6
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    22
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to start a service on computer startup.

    But how can I create the shortcut of the service and place it in the startup folder...
    Is there any way to do that using any Qt class....

  7. #7
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: how to start a service on computer startup.

    Yes, you can use QFile::Link() to create a shortcut and then place it in the startup path, you may need admin right for the program to do so, as mentioned by ChrisW67 earlier

Similar Threads

  1. How to install a service in windows with automatic startup?
    By josecarlosmissias in forum Qt Programming
    Replies: 0
    Last Post: 11th December 2009, 17:01
  2. start the mysql service and run commands
    By cbarmpar in forum Qt Programming
    Replies: 17
    Last Post: 14th September 2008, 23:08
  3. Start Qt application as Windows Service
    By ^NyAw^ in forum Qt Programming
    Replies: 12
    Last Post: 10th May 2008, 17:23
  4. QToolBar go away! On startup anyway.
    By bitChanger in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2006, 18:22

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.