Page 1 of 2
Get list of all available hardisks? (solved)
Posted: Sat Apr 21, 2007 1:06 pm
by Joakim Christiansen
What is the right method to get all available hardisks on the system?
Re: Get list of all available hardisks?
Posted: Sat Apr 21, 2007 1:39 pm
by PB
Code: Select all
For a=65 To 90 : a$=Chr(a)+":\"
If GetDriveType_(a$)=#DRIVE_FIXED
Debug a$+" is a hard drive"
EndIf
Next
Posted: Sat Apr 21, 2007 2:01 pm
by Joakim Christiansen
Nice, thank you very much!

Posted: Sat Apr 21, 2007 8:41 pm
by AND51
Beep!
Why do you check A: and B: ? You know that these drives are always floppy disks?
Checking 67-90 (C-Z) is enough... And faster, since accessing an existing floppy drive takes 2-5 seconds...
Posted: Sat Apr 21, 2007 9:02 pm
by Trond
Code: Select all
For a=65 To 90 : a$=Chr(a)+":\"
If GetDriveType_(a$)=#DRIVE_FIXED
Debug a$+" is a hard drive"
EndIf
Next
#DRIVE_FIXED. I need that for my CD-rom. It's broken.
Posted: Sat Apr 21, 2007 9:34 pm
by AND51
PLEASE LOOK AT THE MSDN YOURSELF! It wrote:DRIVE_UNKNOWN — The drive type cannot be determined.
DRIVE_NO_ROOT_DIR — The root path is invalid; for example, there is no volume is mounted at the path.
DRIVE_REMOVABLE — The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
DRIVE_FIXED — The drive has fixed media; for example, a hard drive or flash drive.
DRIVE_REMOTE — The drive is a remote (network) drive.
DRIVE_CDROM — The drive is a CD-ROM drive.
DRIVE_RAMDISK — The drive is a RAM disk.
Posted: Sat Apr 21, 2007 9:50 pm
by Trond
Posted: Sat Apr 21, 2007 10:18 pm
by AND51
Posted: Sat Apr 21, 2007 10:25 pm
by ts-soft
AND51 wrote:Why do you check A: and B: ? You know that these drives are always floppy disks?
My B: is a RAM-Drive

Posted: Sat Apr 21, 2007 10:32 pm
by AND51
Correction: Not always, but in most cases.
Ts-Soft, it was YOU who recommended me (and others) not to test for floppy disks:
http://www.purebasic.fr/german/viewtopi ... t=&start=0 (Watch the annotation

Posted: Sat Apr 21, 2007 10:40 pm
by ts-soft
>> YOU who recommended me (and others) not to test for floppy disks
Yes, in some situations under win9x it crashes witout a floppy inserted!
Posted: Sat Apr 21, 2007 10:48 pm
by AND51
So it's better
not to test drive A. And with drive B I would be careful, not all ppl have an existing B-drive. In rare cases, ppl have B as a RAM-drive (<= TS-Soft!).
So I'm right, at least a bit.

Posted: Sun Apr 22, 2007 3:54 am
by PB
> Why do you check A: and B: ?
It was a quick example by looping through all letters, since drives are listed
by letters. It was just a proof-of-concept, not a finished procedure or such.
> You know that these drives are always floppy disks?
Really? "subst b: e:" points to my e: hard drive on my system.
And what if no floppy is present on a PC? One could probably (I can't test it)
reassign a: with subst to point somewhere else, too -- just as I can with b: as
no b: floppy drive is present on my system.
Posted: Sun Apr 22, 2007 4:59 am
by Dare
Posted: Sun Apr 22, 2007 10:03 am
by AND51
> not a finished procedure or such
Yes, I know. My posting should just be a hint, not a strong recommendation.
> Really? "subst b: e:" points to my e: hard drive on my system.
OK, I didn't thought about this feature. In spite of that, I believe that 95% of all PCs have A:\ and B:\ correctly established (that means eiter a FDD or nothing).
> And what if no floppy is present on a PC?
There will be an error message ("A:\ is a path that is not available...")
> One could probably reassign a: with subst to point somewhere else
I could do it, but I don't. I assume that the same thing will happen like your drive B: - it'll work correctly.