[DUG] Change Service Startup Type to Disabled
Alan Rose
Alan at seabed.co.nz
Mon May 14 15:43:02 NZST 2007
I eventually found the API on the MSDN website
FWIW heres the code in case someone else finds it useful.
Uses WinSvc
var srvc : SC_HANDLE;
s_man: SC_HANDLE;
dwStartType : word;
begin
dwStartType := SERVICE_DISABLED;
s_man := OpenSCManager(nil, nil, SC_MANAGER_CONNECT);
if s_man <> 0 then
begin
srvc := OpenService(OpenSCManager(nil, nil, SC_MANAGER_CONNECT),
'ServiceNameHere', SERVICE_CHANGE_CONFIG);
if srvc <> 0 then
begin
if not ChangeServiceConfig(srvc, SERVICE_NO_CHANGE,dwStartType,
SERVICE_NO_CHANGE, nil, nil, nil, nil, nil, nil, nil) then
ShowMessage(SysErrorMessage(GetLastError));
end
else ShowMessage(SysErrorMessage(GetLastError));
end
else ShowMessage(SysErrorMessage(GetLastError));
> -----Original Message-----
> From: delphi-bounces at delphi.org.nz
> [mailto:delphi-bounces at delphi.org.nz] On Behalf Of Alan Rose
> Sent: Monday, 14 May 2007 3:12 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: [DUG] Change Service Startup Type to Disabled
>
> Anyone know how to change a Service "Startup Type" from
> Automatic to Disabled in code?
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz
> with Subject: unsubscribe
>
More information about the Delphi
mailing list