Recent

Author Topic: Status Drives Search  (Read 958 times)

d2010

  • Jr. Member
  • **
  • Posts: 61
Status Drives Search
« on: December 05, 2023, 08:43:15 am »
Hello.
I have in batch(".txt") script to reveal -all-drives.()
How to replace this batch(".txt")  with pascal100%source?
--but only  writeble disk/s drive
--but not CD-rom, not DVD
« Last Edit: January 01, 2024, 10:54:41 am by d2010 »

Bart

  • Hero Member
  • *****
  • Posts: 5465
    • Bart en Mariska's Webstek
Re: Windows. Status Drives Search
« Reply #1 on: December 05, 2023, 09:50:54 am »
I have a function like this:
Code: Pascal  [Select][+][-]
  1. function GetAvailableDrives(DiskMustBeInDrive: Boolean = False; DriveTypes: TDriveTypes = AllDriveTypes): TSysCharSet;

As you can guess from it's signature you can search for writable drives that must be mounted.

You can find the code here.

Feel free to use and alter the code if so desired.

Bart

d2010

  • Jr. Member
  • **
  • Posts: 61
Re: Windows. Status Drives Search
« Reply #2 on: January 01, 2024, 10:54:22 am »
Thank you your-code, please you read my hints.
01)you  replace upcase with locase
Code: Pascal  [Select][+][-]
  1.   D := GetLogicalDrives;
  2.   for C := 'a' to 'z' do
  3.   begin
  4.     Mask := (1 shl (Ord(c) - Ord('a')));
  5.     if (Mask and D) = Mask then
  6.     begin
  7.       if ((not DiskMustBeInDrive) or DiskInDrive(C)) and
  8.          (GetDriveType(C) in DriveTypes) then
  9.  
  10.  

 

TinyPortal © 2005-2018