【例子介绍】Windows10开机后,将自动关闭自动更新服务
【相关图片】
【源码结构】
function StartServices(Const SvrName: String): Boolean;
var
a,b:SC_HANDLE;
c:PChar;
begin
Result:=False;
a:=OpenSCManager(nil,nil,SC_MANAGER_ALL_ACCESS);
if a <=0 then Exit;
b:=OpenService(a,PChar(SvrName),SERVICE_ALL_ACCESS);
if b <=0 then Exit;
try
Result:=StartService(b,0,c);
CloseServiceHandle(b);
CloseServiceHandle(a);
except
CloseServiceHandle(b);
CloseServiceHandle(a);
Exit;
end;
end;
评论