Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Uwe Heyer" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: Check if service is running Date: 19 Nov 2013 19:04:55 GMT Lines: 46 Message-ID: References: <528b79ec$0$2349$91cee783@newsreader04.highway.telekom.at> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net ahIFoyoExJ5IDkINLTJncQ4ODG3n4jhkZG8LSxtJcGS+UkBFeM Cancel-Lock: sha1:KmkFTEcq4qG4IJjC26JaNW/+/E0= User-Agent: XanaNews/1.19.1.320 Xref: csiph.com comp.lang.clipper.visual-objects:6247 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