Function IsDriveReady(cDrive : Char) : Boolean; var uiDrvNum : byte; wEMode : Word; begin Result := False; uiDrvNum := ord(cDrive); if uiDrvNum >= ord(\'a\') then dec(uiDrvNum,$20); wEMode := SetErrorMode(SEM_FAILCRITICALERRORS); try if DiskSize(uiDrvNum-$40) <> -1 then Result := True else messagebeep(0); finally SetErrorMode(wEMode); end; end;
constructor TDiscInfo.Create(const drive: char); var Tmp: DWORD; begin FDrive[0] := drive; FDrive[1] := #58; FDrive[2] := #92;
FFreeSpaceAvailable := 0; FTotalSpace := 0;
if GetVolumeInformation(FDrive, nil, 0, nil, Tmp, Tmp, nil, 0) then GetDiskFreeSpaceEx(FDrive, FFreeSpaceAvailable, FTotalSpace, @FTotalFree);
FSerialId := GetDiskVolSerialID(drive); end;
function TDiscInfo.GerDriveSize: string; begin Result := IntToStr(DiskSize(0)); end;
function TDiscInfo.GetDriveType: string; begin case Windows.GetDriveType(FDrive) of DRIVE_UNKNOWN: Result := \'Drive type cannot be determined.\'; DRIVE_NO_ROOT_DIR: Result := \'Root directory does not exist\'; DRIVE_REMOVABLE: Result := \'Floppy drive.\'; DRIVE_FIXED: Result := \'Hard disk drive\'; DRIVE_REMOTE: Result := \'Network drive\'; DRIVE_CDROM: Result := \'CD-ROM drive\'; DRIVE_RAMDISK: Result := \'RAM drive\'; end; end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.