|
-
May 17th, 1999, 10:18 AM
#1
C++ Drive List
I need to show the user a list of drives to select from, is there an easy way to do this in MFC, or if not with the api?
TIA
Jim Hewitt, Liberty Tax Service
-
May 17th, 1999, 11:23 AM
#2
Re: C++ Drive List
There's a function called GetLogicalDrives() that will return to you a DWORD containing a bitmask representing the currently available disk drives. Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.
To determine which drives are present, you can do something like this:
DWORD dwRes = GetLogicalDrives();
if (0 != dwRes)
{
while (dwRes)
{
// Check if the bit is a "1" or a "0"
if (dwRes & 1)
MessageBox("Found a drive!");
// Shift the value over by one
dwRes >>= 1;
}
}
Hope this helps!! Happy coding,
=================================================
Valerie L. Bradley
Software Engineer
Intel Corporation
* All opinions expressed are mine and not those of my employer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|