Autor |
Beitrag |
FriFra
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Do 27.06.02 13:51
Ich will herausfinden ob ein bestimmter Service läuft. Das muss ich aber über den Servicename bzw. Displayname machen, eine Suche nach einer laufenden exe ist für meine Zwecke nicht brauchbar...
|
|
DieHardMan
Beiträge: 19
|
Verfasst: Do 27.06.02 19:53
Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
| function ServiceGetStatus(sMachine, sService: string ): DWord; var schm, schs: SC_Handle; ss: TServiceStatus; dwStat: DWord; begin dwStat := 0; schm := OpenSCManager(PChar(sMachine), Nil, SC_MANAGER_CONNECT); if(schm > 0)then begin schs := OpenService(schm, PChar(sService), SERVICE_QUERY_STATUS); if(schs > 0)then begin if(QueryServiceStatus(schs, ss))then dwStat := ss.dwCurrentState; CloseServiceHandle(schs); end; CloseServiceHandle(schm); end; Result := dwStat; end;
function ServiceRunning(sMachine,sService: string ): boolean; begin Result := SERVICE_RUNNING = ServiceGetStatus(sMachine, sService ); end; |
_________________ Mahlzeit
|
|
FriFra
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Fr 28.06.02 08:27
|
|
|