'Declare an OleVariant and IEnumVariant in Inno Setup
I have a function for getting BIOS serial numbers in the code section that works in Delphi but it doesn't recognize the variable declarations. How do I get around this.
var
FSWbemLocator : OleVariant;
FWMIService : OleVariant;
function GetWMIstring(const WMIClass, WMIProperty:string): string;
var
FWbemObjectSet: OleVariant;
FWbemObject : OleVariant;
oEnum : lEnumVariant;
iValue : LongWord;
begin;
Result:='';
FWbemObjectSet:= FWMIService.ExecQuery(Format('Select %s from %s',[WMIProperty, WMIClass]),'WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
if oEnum.Next(1, FWbemObject, iValue) = 0 then
if not VarIsNull(FWbemObject.Properties_.Item(WMIProperty).Value) then
Result:=FWbemObject.Properties_.Item(WMIProperty).Value;
FWbemObject:=Unassigned;
end;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|