如何识别某盘符的类型,是硬盘、软盘、光盘、还是USB盘,最主要是如何实别出是否为USB盘

LXFY 2003-07-12 11:12:34
如何识别某盘符的类型,是硬盘、软盘、光盘、还是USB盘,最主要是如何实别出是否为USB盘
...全文
118 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
BuZhang_AP97091 2003-07-28
  • 打赏
  • 举报
回复
如果你的电脑有光驱,那好办光盘后的都为USB盘
Linux2001 2003-07-28
  • 打赏
  • 举报
回复
就用GetDriveType可以了啊
cocosky 2003-07-28
  • 打赏
  • 举报
回复
系统 xp , 开发工具 vc 6.0 , 函数 GetDriveType

测试结果 usb 移动硬盘 DRIVE_FIXED(同其他硬盘一样)
usb u 盘 DRIVE_REMOVABLE(同软盘一样)

cocosky 2003-07-28
  • 打赏
  • 举报
回复
我用的还是vc 6.0

查msdn得到的

HRESULT GetDeviceInfo(
LPDIDEVICEINSTANCE pdidi
);

参数和返回值都和你说得不一样呀
你确定 GetDeviceInfo 是如你所说的吗?
HuWenjin 2003-07-28
  • 打赏
  • 举报
回复
mark
titi_lima 2003-07-28
  • 打赏
  • 举报
回复
GetDriveType不行吧,软盘和USB都是DRIVE_REMOVABLE。
喝醉的咖啡 2003-07-28
  • 打赏
  • 举报
回复
同意楼上,用GetDriveType
我估计USB识别出来应该是
DRIVE_REMOVABLE

测试看看结果?
mfc168 2003-07-28
  • 打赏
  • 举报
回复
This function gets a pointer to a device information structure.

LPCUSB_DEVICE GetDeviceInfo( USB_HANDLE hDevice );

Parameters
hDevice
[IN] Handle to a USB device.
Return Values
Returns a pointer to the USB_DEVICE structure for a device.




cocosky 2003-07-28
  • 打赏
  • 举报
回复
gz
zhouyong0371 2003-07-12
  • 打赏
  • 举报
回复
GetDriveType
The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(
LPCTSTR lpRootPathName // root directory
);
Parameters
lpRootPathName
[in] Pointer to a null-terminated string that specifies the root directory of the disk to return information about. A trailing backslash is required. If lpRootPathName is NULL, the function uses the root of the current directory.
Return Values
The return value specifies the type of drive. It can be one of the following values.

Value Meaning
DRIVE_UNKNOWN The drive type cannot be determined.
DRIVE_NO_ROOT_DIR The root path is invalid. For example, no volume is mounted at the path.
DRIVE_REMOVABLE The disk can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the 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.
Ah 2003-07-12
  • 打赏
  • 举报
回复
好像没办法识别出来。
在windows中,USB和硬盘一样对待。

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧