uses
JclSvcCtrl;
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
FSCManager: TJclSCManager;
Service: TJclNtService;
begin
FSCManager := TJclSCManager.Create;
try
FSCManager.Refresh(True);
Memo1.Lines.Clear;
Memo1.WordWrap := False;
for I := 0 to FSCManager.ServiceCount -1 do
begin
Service := FSCManager.Services[I];
Memo1.Lines.Values[Service.ServiceName] := Service.DisplayName;
end;
if FSCManager.FindService('Dhcp', Service) then begin
if Service.ServiceState = ssRunning then begin
Service.Stop;
ShowMessage('Stop Dhcp');
end;
Service.Start;
ShowMessage('Start Dhcp');
end;
finally
FSCManager.Free;
end;
end;
2009年5月30日
Delphi TJclSCManager 列出及控制 Service
需先安裝 JEDI VCL for Delphi
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言