Einzelnen Beitrag anzeigen

dingdoi

Registriert seit: 3. Aug 2004
Ort: Hamburg
26 Beiträge
 
Delphi XE2 Professional
 
#6

Re: "Dienst anhalten" nicht erlauben

  Alt 5. Sep 2004, 17:12
Delphi-Quellcode:
hSCM:=OpenSCManager(NIL, NIL, SC_MANAGER_ALL_ACCESS);
CASE hSCM OF
  0:FatalError;
ELSE BEGIN
  hService:=CreateService(hSCM,
               PChar(ServiceName),
               PChar(DisplayName),
               SERVICE_START OR SERVICE_QUERY_STATUS OR _DELETE,
               SERVICE_WIN32_OWN_PROCESS or SERVICE_INTERACTIVE_PROCESS,
               StartupMode,
               SERVICE_ERROR_NORMAL,
               @modname[0],
               NIL, NIL, NIL, NIL, NIL);
  CASE hService OF
    0:BEGIN
      CloseServiceHandle(hSCM);
      FatalError;
    END;
    ELSE BEGIN
      CloseServiceHandle(hSCM);
      CloseServiceHandle(hService);
    END;
END;
  Mit Zitat antworten Zitat