module1.bas

来自「vb一个通过硬件信息生成序列号的源码示例」· BAS 代码 · 共 32 行

BAS
32
字号
Attribute VB_Name = "Module1"
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:05/03/31
'描  述:一个通过硬件信息生成序列号的源码示例
'网  站:http://www.mndsoft.com
'e-mail:mnd@mndsoft.com
'OICQ  : 88382850
'****************************************************************************
Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerial_Numberber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Const GETDI_SERIAL = 1
Public Const GETDI_LABEL = 2
Public Const GETDI_TYPE = 3
Function GetDriveInfo(strDrive As String, iType As Integer)
    
    Dim Serial_Number As Long
    Dim Drive_Label As String
    Dim Fat_Type As String
    
    Dim Return_Value As Long
    
    Drive_Label = Space(256)
    Fat_Type = Space(256)
    
    Return_Value = GetVolumeInformation(strDrive, Drive_Label, Len(Drive_Label), Serial_Number, 0, 0, Fat_Type, Len(Fat_Type))
    
    GetDriveInfo = CStr(Serial_Number)

End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?