环境是windows2000 server 
      VB6.0

解决方案 »

  1.   

    http://www.csdn.net/expert/topic/934/934383.xml?temp=.7288172http://www.dapha.net/vb/list.asp?id=1886
      

  2.   

    读取硬盘系列号程序如下,可调用getserialnumber("c:\")获得c盘系列号。
    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 LongFunction GetSerialNumber(sRoot As String) As Long
    Dim lSerialNum As Long
    Dim R As Long
    Dim strLabel As String, strType As String
    Dim sTemp1 As String, sTemp2 As String
    strLabel = String$(255, Chr$(0))
    strType = String$(255, Chr$(0))
    R = GetVolumeInformation(sRoot, strLabel, Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))
    GetSerialNumber = lSerialNum
    End Function
      

  3.   

    在VB6.0,Win2000Professional下测试了一下:
    一个窗体,里面有个Text控件,一个模块:
    窗体代码:
    Private Sub Form_Load()Text1.Text = GetSerialNumber("C:\")End SubFunction GetSerialNumber(sRoot As String) As Long
    Dim lSerialNum As Long
    Dim R As Long
    Dim strLabel As String, strType As String
    Dim sTemp1 As String, sTemp2 As String
    strLabel = String$(255, Chr$(0))
    strType = String$(255, Chr$(0))
    R = GetVolumeInformation(sRoot, strLabel, Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))
    GetSerialNumber = lSerialNum
    End Function模块代码:
    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测试结果:
    显示:1423366722