www.pudn.com > GetId.rar > Form1.frm


VERSION 5.00 
Begin VB.Form Form1  
   Caption         =   "Form1" 
   ClientHeight    =   3090 
   ClientLeft      =   60 
   ClientTop       =   450 
   ClientWidth     =   4680 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   3090 
   ScaleWidth      =   4680 
   StartUpPosition =   3  '窗口缺省 
   Begin VB.CommandButton Command1  
      Caption         =   "Command1" 
      Height          =   615 
      Left            =   720 
      TabIndex        =   1 
      Top             =   1920 
      Width           =   2175 
   End 
   Begin VB.TextBox Text1  
      Height          =   1455 
      Left            =   120 
      MultiLine       =   -1  'True 
      TabIndex        =   0 
      Text            =   "Form1.frx":0000 
      Top             =   120 
      Width           =   4215 
   End 
End 
Attribute VB_Name = "Form1" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
  Private Declare Function DiskID32 Lib "DiskID32.DLL" (ByRef DiskModel As Byte, ByRef DiskID As Byte) As Long 
 
Private Sub Command1_Click() 
Dim DiskModel(35) As Byte, DiskID(31) As Byte, i As Integer, Model As String, ID As String 
  If DiskID32(DiskModel(0), DiskID(0)) <> 1 Then 
    MsgBox "get diskid32 err" 
    Exit Sub 
  End If 
  For i = 0 To 31 
    If Chr(DiskModel(i)) <> Chr(0) Then 
        Model = Model & Chr(DiskModel(i)) 
    End If 
    If Chr(DiskID(i)) <> Chr(0) Then 
        ID = ID & Chr(DiskID(i)) 
    End If 
  Next 
  Text1.Text = "硬件产生代码为:" + Model & vbNewLine & "硬盘序列号为:" + ID 
End Sub