List service and services status under Win-7

Posted by Ronaldo Junior on Stack Overflow See other posts from Stack Overflow or by Ronaldo Junior
Published on 2010-04-06T02:16:48Z Indexed on 2010/04/06 2:23 UTC
Read the original article Hit count: 297

Filed under:
|
|

I have a service monitor app that monitors the status of three other servers app - you know those kind of green, red status stuff, start, stop, etc.

The problem is that it shows the wrong state in Windows 7 even if the user is the administrator.

The start, stop buttons are disabled and the install button enabled, the status color is grey which is also wrong. The start button should be enabled with the service status showing green - the apps are running.

If the application is run with the setting "run as administrator" then it behaves normally.

The application is written in Delphi 7 and works perfectly in other versions of Windows. This line of code: OpenSCManager(PChar(sMachine),Nil,SC_MANAGER_ALL_ACCESS) always return 0 under Win7, causing the problem.

Any ideas and if possible, any workaround apart from "run as administrator".

Regards

Ronaldo

© Stack Overflow or respective owner

Related posts about winapi

Related posts about delphi