[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drive detection on win

Hello Bernard,

> Is there a way to get a list of all the disk drives available on a
> windows machine?

I don't think there's an IDL command just for this, but then again you
won't have to go out to C for it.   There's a standard Win32 function
that'll almost give you what you need, and you can call it directly
The function's called GetLogicalDrives and it lives in kernel32.dll - a
core component of Win9x / NT that'll always be present.   You can call
it from IDL like this:
What you'll get back is a 32-bit integer that has its bits set
according to what drives are present.   e.g., If you only have an A:
and a C: drive then you'll get back the value 5.   It also picks up on
network drives that have been mapped to a drive letter.   If it fails
for some reason then it returns zero.
Given this, you could quite easily put together some IDL code to turn
the drive mask into a STRARR of drive names.

Peter Mason

Sent via Deja.com http://www.deja.com/
Before you buy.