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
答案 0 :(得分:2)
您的代码失败,因为objLogicalDisk
变量将实例保存到Win32_LogicalDisk
WMI类,您需要访问Win32_DiskPartition
类。此外,您的示例代码不完整,但似乎您正在使用发布的代码here。如果是这种情况,您可以通过StartingOffset
变量(objPartition
)
objPartition.StartingOffset
媒体资源