How can I disable a service via Delphi?

后端 未结 5 1968
离开以前
离开以前 2021-01-01 21:43

I use a routine that can start and stop services via Delphi but I also need to be able to disable them, is it possible?

5条回答
  •  清酒与你
    2021-01-01 22:27

    Besides using the previous methods, if you need more control you can use WMI.
    With Win32_Service class have access to all information of the services installed on the machine and you can has access to methods: Start, Stop, Pause, Resume, Interrogate, Create, Delete, Change, ChangeStartMode...

    Here (Web / SourceForge)you can find a set of components to work with WMI (GLibWMI components Library); There are one called CServiceInfo thah give you all information and some methods of this class.

    In addition with the package tere are some demos; One is called (ServiceControl) and implement all methods.

    All the package are source included. See the code it can be usefull for you.

    Regards.

提交回复
热议问题