请,我需要一个代码,可以用来确定CD驱动器的驱动器名称. [英] Please, I need a code with which I can determine the drive name of the CD drive.

查看:95
本文介绍了请,我需要一个代码,可以用来确定CD驱动器的驱动器名称.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请,我需要一个代码来确定CD驱动器的驱动器名称.

我正在使用MSIInstal函数开发自定义安装程序,但是该函数需要安装软件包的路径.我面临的问题
如何确定CD驱动器是D,E,F还是G驱动器.

我该如何确定.

Please, I need a code with which I can determine the drive name of the CD drive.

I am in the process of developing a custom installer using MSIInstal function, but the function requires the path to the package to be installed. The problem I am facing
is how do I tell whether the CD drive is drive D,E,F, or G.

How do I determine this.

推荐答案

CD驱动器的驱动器名称可以是AZ中的任何内容,而不仅仅是D,E,F或G,而且可以一台机器中有多个CD驱动器.如果安装程序是从CD或DVD启动的,则应确定安装程序可执行文件的完整路径,并立即获得答案.如果您的安装程序是从软件包以外的其他位置启动的(例如,为什么有人会从硬盘驱动器这样做呢??),则必须在所有CD/DVD驱动程序中搜索安装程序软件包.但是我不仅仅限制从CD/DVD驱动器进行安装,如果您可以从本地软件包中安装某些内容,有时会很方便.
要获取系统中的驱动器列表,请使用 GetLogicalDriveStrings( ) [ ^ ]或 GetLogicalDrives() [ ^ ].
要获取驱动器的类型,请使用 GetDriveType() [ ^ ].
The drive name of a CD drive can be anything from A-Z, not just D,E,F or G, moreover there can be more than one cd drive in a machine. If the installer program is started from the CD or DVD then you should determine the full path of your the installer executable and you get the answer immediately. If your installer is started from a different location than the packages (but why would someone do it like this???) for example from the hard drive then you have to search through all CD/DVD drivers for the installer packages. However I wouldn''t restrict installation just from CD/DVD drives, sometimes it comes handy if you can install something from local packages.
To get the list of drives in the system use GetLogicalDriveStrings()[^] or GetLogicalDrives()[^].
To get the type of a drive use GetDriveType()[^].


这篇关于请,我需要一个代码,可以用来确定CD驱动器的驱动器名称.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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