Comments (1)
The WDCC doesn't create the code to access array properties like this, you
must do this manually using the VarArrayLowBound and VarArrayHighBound methods.
Try this sample
{{{
procedure GetWin32_CDROMDriveInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer ='localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : OLEVariant;
oEnum : IEnumvariant;
iValue : LongWord;
i:Integer;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_CDROMDrive','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0 do
begin
Writeln(Format('Drive %s',[String(FWbemObject.Drive)]));// String
Write('Capabilities [');// Uint16
if not VarIsNull(FWbemObject.Capabilities) and VarIsArray(FWbemObject.Capabilities) then
for i := VarArrayLowBound(FWbemObject.Capabilities, 1) to VarArrayHighBound(FWbemObject.Capabilities, 1) do
Write(FWbemObject.Capabilities[i]);
Writeln(']');
FWbemObject:=Unassigned;
end;
end;
}}}
Original comment by [email protected]
on 28 May 2013 at 12:50
- Changed state: Done
from wmi-delphi-code-creator.
Related Issues (20)
- Portable Edition Cache Files
- Firewall Blocking Issue
- Generic Failure error HOT 2
- Support for Go? HOT 1
- Dose not compile under XE HOT 3
- Win32_networkadapterconfiguration in delphi HOT 1
- About Generating WQL Code HOT 2
- C++ returns wrong UINT64 values HOT 1
- TDM-GCC Support
- Invalid URL in README.md HOT 1
- WDCC does not find Lazarus IDE and Compiler HOT 2
- WMI Finder HOT 1
- Delphi 10.2 - unit OleServer not found HOT 1
- Incorrect Freepascal code generated for GetWMI_Info
- Delphi 10.1 6 And WDCC HOT 1
- WQL Syntax "Where" is not working HOT 1
- WMI From Service HOT 2
- MSFT_Partition / AccessPaths
- Unable to compile : missing Vcl.Themes.dcu/pas HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wmi-delphi-code-creator.