UINT WINAPI GetDriveType(
__in LPCTSTR lpRootPathName
);
The root directory for the drive.
A trailing backslash is required. If this parameter is NULL, the function uses the root of the current directory.
Return Value
The return value specifies the type of drive, which can be one of the following values.
Return code | Description |
---|---|
DRIVE_UNKNOWN | The drive type cannot be determined. |
DRIVE_NO_ROOT_DIR | The root path is invalid; for example, there is no volume is mounted at the path. |
DRIVE_REMOVABLE | The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader. |
DRIVE_FIXED | The drive has fixed media; for example, a hard drive or flash drive. |
DRIVE_REMOTE | The drive is a remote (network) drive. |
DRIVE_CDROM | The drive is a CD-ROM drive. |
DRIVE_RAMDISK | The drive is a RAM disk. |
lpRootPathName末尾下划线很重要.若无则会返回1值
int GetDriveInfo()
{
CString strPath = _T("Y://MPNet//");
UINT nRet = GetDriveType((LPCTSTR)strPath);
return nRet;
}