⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "获取磁盘序列号"
   ClientHeight    =   2505
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5085
   LinkTopic       =   "Form1"
   ScaleHeight     =   2505
   ScaleWidth      =   5085
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox Text1 
      Height          =   405
      Left            =   270
      TabIndex        =   4
      Text            =   "c:\"
      Top             =   795
      Width           =   2880
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   510
      Left            =   3480
      TabIndex        =   2
      Top             =   1515
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      BackColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C0C000&
      Height          =   465
      Left            =   255
      TabIndex        =   1
      Top             =   1530
      Width           =   2895
   End
   Begin VB.CommandButton Command1 
      Caption         =   "获取序列号"
      Height          =   510
      Left            =   3480
      TabIndex        =   0
      Top             =   900
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "磁盘名称:"
      Height          =   255
      Left            =   330
      TabIndex        =   5
      Top             =   525
      Width           =   1710
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "磁盘序列号为:"
      Height          =   480
      Left            =   315
      TabIndex        =   3
      Top             =   1290
      Width           =   2745
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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

Private Sub Command1_Click()
  Dim mySerial As Long
  Dim mylong As Long
  mystr = String$(255, Chr$(0))
  mytype = String$(255, Chr$(0))
  If Right(Text1.Text, 1) <> "\" Then Text1.Text = Text1.Text & "\"
  sRoot = Text1.Text                                   '设定盘名
  mylong = GetVolumeInformation(sRoot, mystr, Len(mystr), mySerial, 0, 0, mytype, Len(mytype))
  Text2.Text = mySerial                                'TEXT2 存放盘序列号
End Sub

Private Sub Command3_Click()
  End
End Sub

⌨️ 快捷键说明

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