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


VERSION 5.00 
Begin VB.Form Form1  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "Form1" 
   ClientHeight    =   4935 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   6915 
   Icon            =   "Form1.frx":0000 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   4935 
   ScaleWidth      =   6915 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.CommandButton Command2  
      Caption         =   "退 出" 
      Height          =   375 
      Left            =   3960 
      TabIndex        =   7 
      Top             =   4320 
      Width           =   1335 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "刷 新" 
      Height          =   375 
      Left            =   1440 
      TabIndex        =   6 
      Top             =   4320 
      Width           =   1335 
   End 
   Begin VB.ListBox List1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   1950 
      Left            =   480 
      TabIndex        =   4 
      Top             =   2160 
      Width           =   6015 
   End 
   Begin VB.Label Label2  
      AutoSize        =   -1  'True 
      Caption         =   "逻辑盘的序列号:" 
      Height          =   180 
      Left            =   480 
      TabIndex        =   5 
      Top             =   1920 
      Width           =   1440 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "Label1" 
      Height          =   180 
      Index           =   3 
      Left            =   480 
      TabIndex        =   3 
      Top             =   1440 
      Width           =   540 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "Label1" 
      Height          =   180 
      Index           =   2 
      Left            =   480 
      TabIndex        =   2 
      Top             =   1040 
      Width           =   540 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "Label1" 
      Height          =   180 
      Index           =   1 
      Left            =   480 
      TabIndex        =   1 
      Top             =   640 
      Width           =   540 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "Label1" 
      Height          =   180 
      Index           =   0 
      Left            =   480 
      TabIndex        =   0 
      Top             =   240 
      Width           =   540 
   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 GetLogicalDrives Lib "kernel32" () As Long 
 
Private Sub Command1_Click() 
    List1.Clear 
    Form_Load 
End Sub 
 
Private Sub Command2_Click() 
Unload Me 
End Sub 
 
Private Sub Form_Load() 
Dim SS As String 
Dim i As Long 
SS = GetHardDiskInfo(hdPrimaryMaster, hdmodelsn) 
If SS = "" Then SS = "NONE" 
Label1(0).Caption = "PrimaryMaster  -> " & SS 
SS = GetHardDiskInfo(hdPrimarySlave, hdmodelsn) 
If SS = "" Then SS = "NONE" 
Label1(1).Caption = "PrimarySlave   -> " & SS 
SS = GetHardDiskInfo(hdSecondaryMaster, hdmodelsn) 
If SS = "" Then SS = "NONE" 
Label1(2).Caption = "SecondaryMaster-> " & SS 
SS = GetHardDiskInfo(hdSecondarySlave, hdmodelsn) 
If SS = "" Then SS = "NONE" 
Label1(3).Caption = "SecondarySlave -> " & SS 
SS = My_Bin(GetLogicalDrives) 
For i = 1 To Len(SS) 
If Val(Mid(SS, i, 1)) = 1 Then List1.AddItem Chr(64 + i) & ":" & GetDiskVolume(Chr(64 + i)) 
Next 
End Sub 
 
Private Function My_Bin(ByVal stt As Long) As String 
While stt 
    My_Bin = My_Bin & Trim(stt Mod 2) 
    stt = stt \ 2 
Wend 
End Function