Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. service status

service status

Scheduled Pinned Locked Moved C / C++ / MFC
json
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Irish_GUI
    wrote on last edited by
    #1

    Hi, i am looking for some api, or method to check the current status of a service and return a value to a program, then if needs be i can start the service via net start or relevant method Thanks

    M A 2 Replies Last reply
    0
    • I Irish_GUI

      Hi, i am looking for some api, or method to check the current status of a service and return a value to a program, then if needs be i can start the service via net start or relevant method Thanks

      M Offline
      M Offline
      Maksim Lepikhin
      wrote on last edited by
      #2

      I am not sure about your specific problem, but you may try using something like this to find your service: SC_HANDLE hM = OpenSCManager(NULL,NULL,SC_MANAGER_ENUMERATE_SERVICE); if (hM) { ENUM_SERVICE_STATUS stat[1024]; DWORD dwNeeded; DWORD dwRet; DWORD dwFirst = 0; if (EnumServicesStatus(hM,SERVICE_WIN32|SERVICE_DRIVER,SERVICE_STATE_ALL,stat,sizeof(stat),&dwNeeded,&dwRet,&dwFirst)) { for (DWORD n=0;n Or, if you are already in posession of the service handle, `BOOL QueryServiceStatus( SC_HANDLE hService, // handle to service LPSERVICE_STATUS lpServiceStatus // service status );` Enjoy! Maksim Lepikhin [www.softforpros.com](http://www.softforpros.com)

      1 Reply Last reply
      0
      • I Irish_GUI

        Hi, i am looking for some api, or method to check the current status of a service and return a value to a program, then if needs be i can start the service via net start or relevant method Thanks

        A Offline
        A Offline
        Arcrest
        wrote on last edited by
        #3

        BOOL QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus ); get its detailed information from MSDN!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups