James Longstreet
May 17th, 1999, 10:18 AM
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
TIA
Jim Hewitt, Liberty Tax Service
|
Click to See Complete Forum and Search --> : C++ Drive List James Longstreet May 17th, 1999, 10:18 AM 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 Valerie Bradley May 17th, 1999, 11:23 AM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |