![]() |
Re: wie installierten Dienst starten?
Hallo, es ist schon möglich den Dienst direkt nach der Installation automatisch zu starten.
Die Unit WinSVC einbinden und im "AfterInstall" Ereignis des Dienstes ungefähr folgendes schreiben: Der Dienst wird dann über den ServiceControlManager gestartet.
Delphi-Quellcode:
Gruß
var
SCMHandle: Cardinal; tmpServiceHandle: Cardinal; fServiceStatus: TServiceStatus; P : pchar; begin p := ''; try SCMHandle := OpenSCManager( NIL, Nil, SC_MANAGER_ALL_ACCESS); if SCMHandle > 0 then begin tmpServiceHandle := OpenService(SCMHandle, PChar('NameDesDienstes'), SERVICE_ALL_ACCESS); if tmpServiceHandle > 0 then begin if StartService(tmpServiceHandle, 0, p) then begin // Dienst erfolgreich gestartet end; end; CloseServiceHandle(tmpserviceHandle); CloseServiceHandle(SCMHandle); end; except end; end; s14 |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:57 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz