![]() |
Service monitoring
I need to know what happening with specified service at runtime to take actions when it state is changed (stopped, deleted, etc.). I tried, but without success, here is what I have:
Delphi-Quellcode:
This raises external exception. How to trace service, please?
procedure SvcNotifyCallback(pvParameter: Pointer);
begin end; procedure TForm1.FormCreate(Sender: TObject); var hSvcMan, hSvc: Cardinal; Buffer: PSERVICE_NOTIFY; begin hSvcMan := OpenSCManager(nil, nil, SC_MANAGER_CONNECT); GetMem(Buffer, SizeOf(PSERVICE_NOTIFYW)); Buffer^.dwVersion := SERVICE_NOTIFY_STATUS_CHANGE; Buffer^.pfnNotifyCallback := @SvcNotifyCallback; Buffer.pContext := Pointer(nil); hSvc := OpenService(hSvcMan, 'UPS', SC_MANAGER_CONNECT); NotifyServiceStatusChange(hSvc, SERVICE_NOTIFY_CREATED or SERVICE_NOTIFY_DELETED, Buffer); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:02 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