[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Drive detection on win
- Subject: Re: Drive detection on win
- From: Peter Mason <menakkis(at)my-deja.com>
- Date: Mon, 23 Oct 2000 20:20:05 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: Deja.com - Before you buy.
- References: <39F06303.FA83CAFA@va.aetc.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:21841
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
with IDL's CALL_EXTERNAL().
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:
drivemask=CALL_EXTERNAL('kernel32.dll','GetLogicalDrives')
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.
Cheers
Peter Mason
Sent via Deja.com http://www.deja.com/
Before you buy.