孙宏雷 发表于 2013-7-2 13:52:12

如何利用API函数找到CD-ROM驱动器的盘号?

淡写轻描 发表于 2013-7-2 13:55:46

下面的函数将检查你计算机所有的驱动器看是否是 CD-ROM,如果是就返回驱动器号,如果没有就返回空字符Public Function GetCDROMDrive() As String Dim lType As Long,I As Integer,tmpDrive as String,found as BooleanOn Error GoTo errLFor I = 0 To 25 tmpDrive = Chr(65 + I) & ":" lType = GetDriveType(tmpDrive) 注释:Win32 API 函数If (lType = DRIVE_CDROM) Then 注释:Win32 API 常数found = True Exit For End If Next If Not found Then tmpDrive = "" BI_GetCDROMDrive = tmpDrive exit Function errL: msgbox error$ End Function
页: [1]
查看完整版本: 如何利用API函数找到CD-ROM驱动器的盘号?