Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6247

Re: Check if service is running

From "Uwe Heyer" <uwe.heyer@aristik.de>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Check if service is running
Date 2013-11-19 19:04 +0000
Message-ID <bf1r2nFknomU1@mid.individual.net> (permalink)
References <528b79ec$0$2349$91cee783@newsreader04.highway.telekom.at>

Show all headers | View raw


Joe Bench wrote:

> Hi there!
> 
> How can i check if a service on a remote machine is running?
> I can start a service via script, i can stop it. Great.
> But the scipts can not give feedback, if the start/stop fails.
> 
> My client application needs to know, if this service is running or
> not.
> 
> Any ideas?
> 
> kindest regards,
> Joe

Hi Joe,

I can't give you any code sample, you need asking google or MSDN

google for SERVICE_STATUS_PROCESS (== StatusStructure) or may be
defined in VO yet


the short story
hManager := openSCManager(szTarget, Null, SC_MANAGER_ALL_ACCESS)
hService := OpenService(hManger, szServiceName, SERVICE_ALL_ACCESS)
QueryServiceStatusEx(hService,                 
            SC_STATUS_PROCESS_INFO, // get status
            @StatusStructure,                  
            _sizeof(SERVICE_STATUS_PROCESS),   
            @dwBytesNeeded )                   

? StatusStructure.dwCurrentState // SERVICE_PAUSED == 7

CloseServiceHandle(hService)
CloseServiceHandle(hManager)


you need access rights for szTarget 


Ahoj
-Uwe

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-19 15:47 +0100
  Re: Check if service is running "Uwe Heyer" <uwe.heyer@aristik.de> - 2013-11-19 19:04 +0000
    Re: Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-20 08:29 +0100
      Re: Check if service is running Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-11-20 09:54 +0100
      Re: Check if service is running "Uwe Heyer" <uwe.heyer@aristik.de> - 2013-11-20 21:20 +0000
        Re: Check if service is running Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-11-20 23:02 +0100
          Re: Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-21 08:07 +0100
  Re: Check if service is running dlzc <dlzc1@cox.net> - 2013-11-19 13:36 -0800

csiph-web