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


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

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-20 21:20 +0000
Message-ID <bf4ncbF8pabU1@mid.individual.net> (permalink)
References <528b79ec$0$2349$91cee783@newsreader04.highway.telekom.at> <bf1r2nFknomU1@mid.individual.net> <528c64d6$0$12672$91cee783@newsreader03.highway.telekom.at>

Show all headers | View raw


Joe Bench wrote:

> Hi Uwe,
> 
> > 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
> 
> Where do i get the function QueryServiceStatusEx?
> 
> Thx and greetings,
> Joe

Hi Joe,

regarding Fred's tip you can use QueryServiceStatus either.

the structure name should be SERVICE_STATUS. In the case it is unknow
for VO use this as template

typedef struct _SERVICE_STATUS 
{  DWORD dwServiceType; 
   DWORD dwCurrentState;  
   DWORD dwControlsAccepted;  
   DWORD dwWin32ExitCode; 
   DWORD dwServiceSpecificExitCode;  
   DWORD dwCheckPoint; 
   DWORD dwWaitHint;
} SERVICE_STATUS, 
*LPSERVICE_STATUS;

it is a structur with a set of DWORDs only. Align it like other win api
structures (see vo sdk)


The (dwCurrentState) current state of the service. This member can be
one of the following values.

Value Meaning 
SERVICE_CONTINUE_PENDING
0x00000005
 The service continue is pending.
 
SERVICE_PAUSE_PENDING
0x00000006
 The service pause is pending.
 
SERVICE_PAUSED
0x00000007
 The service is paused.
 
SERVICE_RUNNING
0x00000004
 The service is running.
 
SERVICE_START_PENDING
0x00000002
 The service is starting.
 
SERVICE_STOP_PENDING
0x00000003
 The service is stopping.
 
SERVICE_STOPPED
0x00000001
 The service is not running.
 
Sorry, I don't own a copy of VO so my help is somewhat imprecive 

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