마음의 안정을 찾기 위하여 - [Delphi] Get service Info from the path of its executable
1832233
276
529
관리자새글쓰기
태그위치로그방명록
, oraz kiedy owo nie całeg...
allegra5/14:08
ustawienie anten Gliwice ...
montaż anteny Gliwice/01/15
lista przebojów Zapraszam...
lista przebojów top20 wsze.../01/14
이젠 옛날처럼 돌아 갈수 없...
후미/01/10
그리움님 안녕하세요 ㅎㅎㅎ...
소울/01/05
별일없다의 생각
dawnsea's me2day/2010
색상(RGB)코드 추출기(Color...
Connection Generator/2010
최승호PD, '4대강 거짓말 검...
Green Monkey**/2010
Syng의 생각
syng's me2DAY/2010
천재 작곡가 윤일상이 기획,...
엘븐킹's Digital Factory/2010
[Delphi] Get service Info from the path of its executable
Delphi/윈도우즈 | 2020/12/28 11:18


//-----------------------------------------------------------------------------------------------------
//     This code was generated by the Wmi Delphi Code Creator (WDCC) Version 1.9.9.350 //     http://code.google.com/p/wmi-delphi-code-creator/ //     Blog http://theroadtodelphi.wordpress.com/wmi-delphi-code-creator/ //     Author Rodrigo Ruz V. (RRUZ) Copyright (C) 2011-2015 //----------------------------------------------------------------------------------------------------- // //     LIABILITY DISCLAIMER //     THIS GENERATED CODE IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. //     YOU USE IT AT YOUR OWN RISK. THE AUTHOR NOT WILL BE LIABLE FOR DATA LOSS, //     DAMAGES AND LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS CODE. // //---------------------------------------------------------------------------------------------------- program GetWMI_Info; {$APPTYPE CONSOLE} uses   SysUtils,   ActiveX,   ComObj,   Variants; // La clase Win32_Service representa un servicio en un sistema Win32. Un // aplicación de servicio cumple las reglas de la interfaz del Administrador de // control de servicios (SCM, Service Control Manager) y un usuario la puede // iniciar automáticamente al arrancar el sistema a través del programa Servicios // del Panel de control o mediante una aplicación que utilice las funciones de // servicio de la API de Win32. Los servicios se pueden ejecutar aunque ningún // usuario haya iniciado sesión en el sistema. procedure  GetWin32_ServiceInfo(sPath:String); const   WbemUser            ='';   WbemPassword        ='';   WbemComputer        ='localhost';   wbemFlagForwardOnly = $00000020; var   FSWbemLocator : OLEVariant;   FWMIService   : OLEVariant;   FWbemObjectSet: OLEVariant;   FWbemObject   : OLEVariant;   oEnum         : IEnumvariant;   iValue        : LongWord; begin;   FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');   FWMIService   := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);   FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_Service WHERE PathName like "%' + sPath + '%"','WQL',wbemFlagForwardOnly);   oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;   while oEnum.Next(1, FWbemObject, iValue) = 0 do   begin     Writeln(Format('Caption        %s',[String(FWbemObject.Caption)]));// String     Writeln(Format('DisplayName    %s',[String(FWbemObject.DisplayName)]));// String     Writeln(Format('Name           %s',[String(FWbemObject.Name)]));// String     Writeln(Format('PathName       %s',[String(FWbemObject.PathName)]));// String     Writeln('');     FWbemObject:=Unassigned;   end; end; begin  try     CoInitialize(nil);     try       GetWin32_ServiceInfo(ExtractFileName('c:\windows\system\locator.exe'));     finally       CoUninitialize;     end;  except     on E:EOleException do         Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));     on E:Exception do         Writeln(E.Classname, ':', E.Message);  end;  Writeln('Press Enter to exit');  Readln;      end.
2020/12/28 11:18 2020/12/28 11:18
Article tag list Go to top
View Comment 0
Trackback URL :: 이 글에는 트랙백을 보낼 수 없습니다
 
 
 
 
: [1][2][3][4][5][6] ... [851] :
«   2021/01   »
          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 27 28 29 30
31            
전체 (851)
출판 준비 (0)
My-Pro... (41)
사는 ... (492)
블로그... (22)
My Lib... (32)
게임 ... (23)
개발관... (3)
Smart ... (1)
Delphi (76)
C Builder (0)
Object... (0)
VC, MF... (9)
Window... (1)
Open API (3)
Visual... (0)
Java, JSP (2)
ASP.NET (0)
PHP (4)
Database (12)
리눅스 (28)
Windows (21)
Device... (1)
Embedded (1)
게임 ... (0)
Web Se... (2)
Web, S... (19)
잡다한... (5)
프로젝트 (0)
Personal (0)
대통령... (9)
Link (2)