首页 >> 读书频道 >> 电脑 >> 取得Disk Driver List与各个Driver的型态
 
· 中文化TextBox
· 如何关闭ScreenSa
· 如何设定屏幕分辨率
· 如何拦截ComboBox
· 在TextBox中如何得
· 正常结束由Shell所引
· 在TextBox中如何得
· 如何取得与设定、删除Re
· 正常结束由Shell所引
· 设定StatusBar的
· 建立闪烁的视窗title
· 深入探讨SQL2000对
 
· 电视剧《刁蛮公主》下载和
· 美容养颜手册
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

取得Disk Driver List与各个Driver的型态


查看有无更新版本

关键字:VB 2006-9-18

 

Private Declare Function GetDriveType Lib "kernel32" _ Alias "GetDriveTypeA" (ByVal nDrive As String) As LongPrivate Declare Function GetLogicalDriveStrings Lib "kernel32" _ Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, _ ByVal lpBuffer As String) As Long'GetDriveType()的传回值意义如下:'0 The drive type cannot be determined.'1 The root directory does not exist.'2 The drive can be removed from the drive.'3 The disk cannot be removed from the drive.'4 The drive is a remote (network) drive.'5 The drive is a CD-ROM drive.'6 The drive is a RAM disk.Private Sub Command1_Click()Dim drv() As String, i As LongDim DrvType As LongCall GetAvailDriver(drv())For i = LBound(drv) To UBound(drv) DrvType = GetDriveType(drv(i)) Select Case DrvType Case 2 Debug.Print drv(i), "软碟" Case 3 Debug.Print drv(i), "硬碟" Case 4 Debug.Print drv(i), "网路磁碟" Case 5 Debug.Print drv(i), "光碟" Case 6 Debug.Print drv(i), "RamDisk" Case Else Debug.Print drv(i), "不明" End SelectNext iEnd Sub'取得所有可用的DiskDriver ListPublic Sub GetAvailDriver(DriverName() As String)Dim totlen As LongDim buff As String, totDrvCnt As LongDim i As Long, tmpstr As String, j As Longbuff = String(255, 0)totlen = GetLogicalDriveStrings(256, buff)'取得的值如: "a:\"+Chr(0)+"c:\"+Chr(0) + "d:\"+Chr(0) + Chr(0)'而这个例子中传回长度(totlen)是12buff = Left(buff, totlen)totDrvCnt = 0For i = 1 To totlen tmpstr = Mid(buff, i, 1) If tmpstr = Chr(0) Then totDrvCnt = totDrvCnt + 1 End IfNext iReDim DriverName(totDrvCnt - 1)j = 0For i = 1 To totDrvCnt j = InStr(1, buff, Chr(0)) DriverName(i - 1) = Left(buff, j - 1) buff = Mid(buff, j + 1)Next iEnd Sub

取得Disk Driver List与各个Driver的型态

[ 1 ]
取得Disk Driver List与各个Driver的型态 num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑