通过这段程序能得到软盘,硬盘的序列号。 
     Private Declare Function GetVolumeInformation Lib _ 
     "kernel32.dll" Alias "GetVolumeInformationA" (ByVal _ 
     lpRootPathName As String, ByVal lpVolumeNameBuffer As _ 
     String, ByVal nVolumeNameSize As Integer, _ 
     lpVolumeSerialNumber As Long, lpMaximumComponentLength _ 
     As Long, lpFileSystemFlags As Long, ByVal _ 
     lpFileSystemNameBuffer As String, ByVal _ 
     nFileSystemNameSize As Long) As Long 
     Function GetSerialNumber(strDrive As String) As Long 
     
     Dim SerialNum As Long 
     
     Dim Res As Long 
     Dim Temp1 As String 
     Dim Temp2 As String 
     
     Temp1 = String$(255, Chr$(0)) 
     Temp2 = String$(255, Chr$(0)) 
     
     Res = GetVolumeInformation(strDrive, Temp1, _ 
     Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2)) 
     
     GetSerialNumber = SerialNum 
     
     End Function 

解决方案 »

  1.   

    只 有 Pentium III系 列 CPU才 能 返 回 序 列 号 。 使 用 汇 编 CPUID指 令 ( 机 器 码 A20F) 来 实 现 。 你 可 以 阅 读 AP-909: Intel Processor Serial Number( http://developer.intel.com/design/pentiumiii/applnots/245125.htm) 以 了 解 如 何 获 得 序 列 号 。 CPUID指 令 早 在 486 DX4中 就 出 现 了 , 可 以 阅 读 AP-485 Intel Processor Identification and the CPUID Instruction( http://developer.intel.com/design/celeron/applnots/241618.htm) 以 了 解 这 条 指 令 的 用 法 。 
      

  2.   

    得到硬盘序列号
    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 = 3Function 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
      

  3.   

    这好像不是硬盘的序列号哦,而且三星的硬盘好像是没有序列号的
    在vb里要取得cpuid或硬盘序列号,呵呵~~我不会,还是用ocx或dll吧