Forum > Windows

Status Drives Search

(1/1)

d2010:
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

Bart:
I have a function like this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
Thank you your-code, please you read my hints.
01)you  replace upcase with locase

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  D := GetLogicalDrives;  for C := 'a' to 'z' do  begin    Mask := (1 shl (Ord(c) - Ord('a')));    if (Mask and D) = Mask then    begin      if ((not DiskMustBeInDrive) or DiskInDrive(C)) and         (GetDriveType(C) in DriveTypes) then  

Navigation

[0] Message Index

Go to full version