The GetElement
part:
if objWBL.GetElement($25000061, objElement) and //<-- fails here on Server 2012
(not VarIsNull(objElement))
then
Result := StrToIntDef(objElement.Integer, 0)
else
Result := 0;
can be replace with EnumerateElements
:
if objWBL.EnumerateElements(objArray) then try
for i := VarArrayLowBound(objArray, 1) to VarArrayHighBound(objArray, 1) do begin
objElement := objArray[i];
if objElement.Type = $25000061 then
Exit(objElement.Integer);
end;
finally VarClear(objArray); end;
This doesn't raise the EOleException
, but sadly also doesn't find the NumberOfProcessors
element.