Link to home
Start Free TrialLog in
Avatar of kevinward66
kevinward66

asked on

hard drive info

anyone know where i can get info on my hard drive, ie the name and size, is it in the registry? can somebody give me the necessary code?




thanks

kevin ward
Avatar of Mohammed Nasman
Mohammed Nasman
Flag of Palestine, State of image

ASKER CERTIFIED SOLUTION
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Cesario, I havn't seen you around from long time
Welcome back again :o)
Avatar of Fraction
Fraction

The most common volume info routines:

procedure DriveInfo(Drive: Char);
type
  TDriveType = (dtUnknown, dtNoDrive, dtFloppy, dtFixed, dtNetwork, dtCDROM, dtRAM);
var
  x: integer;
  VSize, VFree: int64;
  VLabel, FSys: array[0..$FF] of char;
  SNr, FL, SysFlag: DWord;
begin
  if not(GetVolumeInformation(PChar(Drive+':\'), VLabel, SizeOf(VLabel), @SNr, FL, SysFlag, FSys, SizeOf(FSys))) then VLabel := '_None_';
  // VLabel  = Volume Label
  // SNr     = Serial Number
  // FL      = Max Filename Length
  // SysFlag = Volume Attributes
  // FSys    = File System (FAT / FAT32 / NTFS etc.)

  x := GetDriveType(PChar(Drive+':\'));
  // x       = TDriveType (See above)

  VSize := DiskSize(Ord(UpCase(Drive))-64);
  VFree := DiskFree(Ord(UpCase(Drive))-64);
  // VSize   = Volume Size
  // VFree   = Free space
end;

GL!