How can I disable a service via Delphi?

delphi, service

Solution

ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=disabled', nil, SW_HIDE);
ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=auto', nil, SW_HIDE);
ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=demand', nil, SW_HIDE);

Problem

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?

Original source

Related problems