I got a message
Method 'StartingOffset' not supported by automation object.
Here is a small part of my code:
colLogicalDisks := objWMIService.ExecQuery('ASSOCIATORS OF {Win32_DiskPartition.DeviceID="'+VarToStr(objPartition.DeviceID)+'"} WHERE AssocClass = Win32_LogicalDiskToPartition');
oEnumLogical := IUnknown(colLogicalDisks._NewEnum) as IEnumVariant;
while oEnumLogical.Next(1, objLogicalDisk, iValue) = 0 do
begin
ShowMessage(objLogicalDisk.StartingOffset);
driveletter := string(objLogicalDisk.DeviceID);
if driveletter = ExtractFileDrive(GetCurrentDir) then
begin
SetLength(result, 6);
result[0] := string(objdiskDrive.DeviceID);
result[1] := string(objdiskDrive.Model);
result[2] := string(objdiskDrive.MediaType);
result[3] := string(ConvertBytes(objdiskDrive.Size));
result[4] := string(objLogicalDisk.Description);
result[5] := string(ConvertBytes(objLogicalDisk.Size));
end;
objLogicalDisk:=Unassigned;
end;
Source code from here
Your code fails because the objLogicalDisk
variable holds an instance to the Win32_LogicalDisk
WMI class and you need access to the Win32_DiskPartition
class. Also your sample code is not complete but it seems which your are using the code posted here. If that is the case you can access to the StartingOffset
property via the objPartition
variable (objPartition.StartingOffset
)