More examples can be found at:
http://www.planetmps.com/
function GetValue(Name : System.String; obj : ManagementObject): System.String; var tempstr : System.&String; pos : integer; args : array of System.&Object; begin SetLength(args, 1); args[0] := 1; tempstr := System.&String(obj.GetText(TextFormat.Mof)); pos := 0; pos := tempstr.IndexOf(Name); If (pos > 0) Then begin pos := pos + Name.Length; pos := pos + 3; tempstr := tempstr.Substring(pos, tempstr.Length - pos); pos := tempstr.IndexOf(';'); tempstr := tempstr.Substring(0, pos); tempstr := tempstr.Replace('{', ''); tempstr := tempstr.Replace('}', ''); tempstr := tempstr.Replace(char(34), ''); getvalue := tempstr; end; If pos < 1 Then begin getvalue := ''; end; end; procedure TWinForm.TWinForm_Load(sender: System.Object; e: System.EventArgs); var FSO : Scripting.FileSystemObject; txtstream : Scripting.TextStream; mos : ManagementObjectSearcher; moc : ManagementObjectCollection; objEnum : System.Collections.IEnumerator; obj : ManagementObject; objEnum1 : ManagmentObjectCollection.ManagementObjectEnumerator; obj1 : ManagementObject; PropSet : PropertyDataCollection; propEnum : ProeprtyDataCollection.ProeprtyDataEnumerator; Prop : PropertyData; x : Integer; y : Integer; w : Integer; v : Integer; begin x := 0; y := 0; w := 0; mos:= ManagementObjectSearcher.Create('Win32_Terminal'); mos.Scope.Path.Path='root\\CIMV2\\TerminalServices'); moc := mos.Get(); objEnum := moc.GetEnumerator(); while (objEnum.MoveNext())do begin mo := System.Management.ManagementObject(objEnum.Current); PropSet := mo.Properties; propEnum := PropSet.GetEnumerator(); while (propEnum.MoveNext()) do begin Prop := System.Management.PropertyData(propEnum.Current); end; end;
No comments:
Post a Comment