Ver Mensaje Individual
  #3  
Antiguo 21-02-2020
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - Espańa
Posts: 18.286
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Si no deseas instalar componentes (que en este caso te facilitarán el trabajo) puedes usar directamente cósigo para acceder a WMI.

Creo que el ejemplo que hay en esta entrada es justo lo que necesitas.
https://neftali.clubdelphi.com/wmi-introduccion/

Ahí puedes obtener todos los datos que necesitas a través de WMI de la clase para discos duros Win32_DISKDRIVE;

Eso sí, debes modificarlo porque ahí sólo consulta el primero. Debes ańadir un WHILE/FOR para que recorra todos los existentes.

Si usas los componentes eso ya lo tienes solucionado y el resultado ya lo puedes obtener como un objeto de una clase.



Código Delphi [-]
 //: Clase para definir las propiedades del componente.
  TDiskDriveProperties = class(TPersistent)
  private
    ...
  private
    function GetCapabilities(index: integer): Integer;
    function GetCapabilityDescriptions(index: integer): string;
    function GetPowerManagementCapabilities(index: integer): Integer;
    // Obtener la propiedad  como string
    function GetAvailabilityAsString():string;
    // Obtener la propiedad  como string
  public
    property Capabilities[index:integer]:Integer read GetCapabilities;
    property CapabilitiesCount:integer read FCapabilitiesCount stored False;
    property CapabilityDescriptions[index:integer]:string read GetCapabilityDescriptions;
    property CapabilityDescriptionsCount:integer read FCapabilityDescriptionsCount stored False;
    property PowerManagementCapabilities[index:integer]:Integer read GetPowerManagementCapabilities;
    property PowerManagementCapabilitiesCount:integer read FPowerManagementCapabilitiesCount stored False;
  published
    property Availability:Integer read FAvailability write FAvailability stored False;
    property AvailabilityAsString:string read GetAvailabilityAsString write FAvailabilityAsString stored False;
    property BytesPerSector:Longword read FBytesPerSector write FBytesPerSector stored False;
    property CapabilitiesAsString:string read FCapabilitiesAsString write FCapabilitiesAsString stored False;
    property CapabilityDescriptionsAsString:string read FCapabilityDescriptionsAsString write FCapabilityDescriptionsAsString stored False;
    property Caption:string read FCaption write FCaption stored False;
    property CompressionMethod:string read FCompressionMethod write FCompressionMethod stored False;
    property ConfigManagerErrorCode:Longword read FConfigManagerErrorCode write FConfigManagerErrorCode stored False;
    property ConfigManagerUserConfig:boolean read FConfigManagerUserConfig write FConfigManagerUserConfig stored False;
    property CreationClassName:string read FCreationClassName write FCreationClassName stored False;
    property DefaultBlockSize:Int64 read FDefaultBlockSize write FDefaultBlockSize stored False;
    property Description:string read FDescription write FDescription stored False;
    property DeviceID:string read FDeviceID write FDeviceID stored False;
    property ErrorCleared:boolean read FErrorCleared write FErrorCleared stored False;
    property ErrorDescription:string read FErrorDescription write FErrorDescription stored False;
    property ErrorMethodology:string read FErrorMethodology write FErrorMethodology stored False;
    property FirmwareRevision:string read FFirmwareRevision write FFirmwareRevision stored False;
    property Index:Longword read FIndex write FIndex stored False;
    property InstallDate:TDateTime read FInstallDate write FInstallDate stored False;
    property InterfaceType:string read FInterfaceType write FInterfaceType stored False;
    property LastErrorCode:Longword read FLastErrorCode write FLastErrorCode stored False;
    property Manufacturer:string read FManufacturer write FManufacturer stored False;
    property MaxBlockSize:Int64 read FMaxBlockSize write FMaxBlockSize stored False;
    property MaxMediaSize:Int64 read FMaxMediaSize write FMaxMediaSize stored False;
    property MediaLoaded:boolean read FMediaLoaded write FMediaLoaded stored False;
    property MediaType:string read FMediaType write FMediaType stored False;
    property MinBlockSize:Int64 read FMinBlockSize write FMinBlockSize stored False;
    property Model:string read FModel write FModel stored False;
    property Name:string read FName write FName stored False;
    property NeedsCleaning:boolean read FNeedsCleaning write FNeedsCleaning stored False;
    property NumberOfMediaSupported:Longword read FNumberOfMediaSupported write FNumberOfMediaSupported stored False;
    property Partitions:Longword read FPartitions write FPartitions stored False;
    property PNPDeviceID:string read FPNPDeviceID write FPNPDeviceID stored False;
    property PowerManagementCapabilitiesAsString:string read FPowerManagementCapabilitiesAsString write FPowerManagementCapabilitiesAsString stored False;
    property PowerManagementSupported:boolean read FPowerManagementSupported write FPowerManagementSupported stored False;
    property SCSIBus:Longword read FSCSIBus write FSCSIBus stored False;
    property SCSILogicalUnit:Integer read FSCSILogicalUnit write FSCSILogicalUnit stored False;
    property SCSIPort:Integer read FSCSIPort write FSCSIPort stored False;
    property SCSITargetId:Integer read FSCSITargetId write FSCSITargetId stored False;
    property SectorsPerTrack:Longword read FSectorsPerTrack write FSectorsPerTrack stored False;
    property SerialNumber:string read FSerialNumber write FSerialNumber stored False;
    property Signature:Longword read FSignature write FSignature stored False;
    property Size:Int64 read FSize write FSize stored False;
    property Status:string read FStatus write FStatus stored False;
    property StatusInfo:Integer read FStatusInfo write FStatusInfo stored False;
    property SystemCreationClassName:string read FSystemCreationClassName write FSystemCreationClassName stored False;
    property SystemName:string read FSystemName write FSystemName stored False;
    property TotalCylinders:Int64 read FTotalCylinders write FTotalCylinders stored False;
    property TotalHeads:Longword read FTotalHeads write FTotalHeads stored False;
    property TotalSectors:Int64 read FTotalSectors write FTotalSectors stored False;
    property TotalTracks:Int64 read FTotalTracks write FTotalTracks stored False;
    property TracksPerCylinder:Longword read FTracksPerCylinder write FTracksPerCylinder stored False;
  end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita