如何确定特定驱动器的类型? [英] How can I determine the type of a particular drive?

查看:98
本文介绍了如何确定特定驱动器的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对获得CPU的硬件信息还不太满意,所以我提出了这样的要求:硬盘,CD/DVD/蓝光阅读器,软盘以及USB(如果可能). 我一直在寻找MSDN GetDriveType ,但是似乎我搜索不好,或者我听不懂.有什么主意吗?

I feel somewhat noob yet with this of getting the Information of Hardware of the CPU, so i come with this request: Hard Drive, CD/DVD/Bluray reader, Floppy and if it's possible USB. I've been looking on MSDN GetDriveType but seems i'm bad at searching or i don't understand it. Any idea?

推荐答案

我不确定您对链接到的文档有什么不了解...

I'm not sure what you didn't understand about the documentation you linked to...

该函数接受的唯一参数是要获取有关其信息(包括尾部反斜杠)的驱动器的根目录.该函数返回一个值,指示是哪种类型的驱动器.显示了一个图表,其中给出了可能的返回值以及每个返回值的含义.

The sole argument accepted by the function is the root directory of the drive you want to get information about (including a trailing backslash). The function returns a value indicating which type of drive that is. A chart is shown that gives the possible return values and what each of them mean.

例如:

GetDriveType(_T("C:\\"))    // returns DRIVE_FIXED if C:\ is my hard drive
GetDriveType(_T("A:\\"))    // returns DRIVE_REMOVABLE if A:\ is my floppy drive
GetDriveType(_T("D:\\"))    // returns DRIVE_CDROM if D:\ is a CD-ROM drive
GetDriveType(_T("N:\\"))    // returns DRIVE_REMOTE if N:\ is a network drive

它还表示,如果要确定驱动器是否为USB型驱动器,则需要调用

It also says that if you want to determine whether a drive is a USB-type drive, you need to call the SetupDiGetDeviceRegistryProperty function and specify the SPDRP_REMOVAL_POLICY property.

这篇关于如何确定特定驱动器的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆