Reputation: 6376
I am using the IShellFolder
interface to enumermate the Shell namespace objects. Doing this I am getting my mapped network drives, of which some are connected and available and others are not.
I would to know how I can detect whether or not a particular mapped drive is available. Is there some method, shell function or attribute that I can use?
I am using IShellFolder.GetAttributesOf()
method to get various attributes on the drive, but do not see anything there that would indicate this.
Upvotes: 1
Views: 1092
Reputation: 37152
If a mapped drive is disconnected it will not appear in the bitmask returned by the GetLogicalDrives
function.
For example,
wchar_t wchDriveLetter = L'P'; // example
int iDriveNumber = towupper(wchDriveLetter) - L'A';
bool fIsDisconnected = ( GetLogicalDrives() & ( 1 << iDriveNumber ) ) == 0;
Upvotes: 1