欢迎光临:
  
  非常感谢您光临枕善居。本站是一个免费的基于VB,VB.NET源代码交流的平台,为大家提供优质的专业的源代码,如果您有需要,本站可以帮助在业余时间里给您寻找代码。当然,如果您有好的代码也可以在本站发布,共享给大家。
专业VB和.NET源码、编程开发教程、图标资源、USB电脑遥控器、智能家电控制开关....更多东东请进入我的淘宝小店--->
VB及.NET新源码2011(3DVD,控件+资源) 智能多路控制(串口编程开关) 带源码!


05-03
30

设置磁盘卷标和获取驱动器类型的API

Private Declare Function SetVolumeLabel Lib "kernel32" Alias "SetVolumeLabelA" (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Long


Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long


Private Sub Form_Load()
    设置磁盘卷标
    SetVolumeLabel "C:\", "NHGames"
    '获取驱动器类型
    Me.Caption = GetDriveType("C:\")
    'Name The Drives


    If Me.Caption = "0" Then
        Me.Caption = "DRIVE_UNKNOWN"
    End If


    If Me.Caption = "1" Then
        Me.Caption = "DRIVE_ABSENT"
    End If


    If Me.Caption = "2" Then
        Me.Caption = "DRIVE_REMOVABLE"
    End If


    If Me.Caption = "3" Then
        Me.Caption = "DRIVE_FIXED"
    End If


    If Me.Caption = "4" Then
        Me.Caption = "DRIVE_REMOTE"
    End If


    If Me.Caption = "5" Then
        Me.Caption = "DRIVE_CDROM"
    End If


    If Me.Caption = "6" Then
        Me.Caption = "DRIVE_RAMDISK"
    End If
End Sub


相关日志:
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 0 | 引用: 0 | 查看次数: 6374

发表评论
您没有权限发表评论!