原型:DWORD GetLogicalDrivers (void); 说明:函数返回值是一个long型,将其用二进制显示时,其中第0位表示A盘,第1位表示B盘,当某位为1时说明存在这个盘,即00000011表示有A盘和B盘。 看这个例子: #include <windows.h> ![]() ![]() ![]() ![]() ![]() 改下: #include <windows.h> 判断某个盘符是否存在: #include <windows.h> MSDN: GetLogicalDrivesThe GetLogicalDrives function retrieves a bitmask representing the currently available disk drives. DWORD GetLogicalDrives(VOID); ParametersThis function has no parameters. Return ValuesIf the function succeeds, the return value is 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. If the function fails, the return value is zero. To get extended error information, call GetLastError. RemarksWindows XP: This function returns a concatenation of the logical disks in the Global and Local MS-DOS Device namespaces. If a logical disk exists in both namespaces, this function will return the entry in the Local MS-DOS Devices namespace. For more information on the Global and Local MS-DOS Device namespaces and changes to the accessibility of MS-DOS device names in Windows XP, refer to MS-DOS Device Names. RequirementsWindows NT/2000/XP: Included in Windows NT 3.1 and later. |
|