• 0
Sign in to follow this  
geforce

Reiniciar Um Serviço Do Windows 2000/xp

Question

2 answers to this question

Recommended Posts

  • 0

uses WinSvc;
var HSC,HS:THandle; p:PChar;
begin
  HSC := OpenSCManager(nil, nil, SC_Manager_Connect);
  HS  := OpenService(HSC, 'Nome_do_Serviço', SC_Manager_All_Access);
  p    := nil;
  StartService(HS, 0, p); // starta o serviço sem parâmetros
  CloseServiceHandle(HS);
  CloseServiceHandle(HSC);
end;

Se tiver parâmetros, você tem que colocar o número deles no segundo parâmetro de StartService e no PChar um array de strings terminando com #0 como última string.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this