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

📄 ȡ

📁 取得CPU序列号
💻
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1965
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   3300
   LinkTopic       =   "Form1"
   ScaleHeight     =   1965
   ScaleWidth      =   3300
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "取得CPU序列号"
      Height          =   375
      Left            =   840
      TabIndex        =   1
      Top             =   1080
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   480
      MultiLine       =   -1  'True
      TabIndex        =   0
      Text            =   "取得CPU序列号.frx":0000
      Top             =   360
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'取得CPU序列号
    
  Private Type OSVERSIONINFO
                  dwOSVersionInfoSize   As Long
                  dwMajorVersion   As Long
                  dwMinorVersion   As Long
                  dwBuildNumber   As Long
                  dwPlatformId   As Long
                  szCSDVersion   As String * 128                   '     Maintenance   string   for   PSS   usage
  End Type
  Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
  Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  Private Const VER_PLATFORM_WIN32_NT = 2
  Private Const VER_PLATFORM_WIN32_WINDOWS = 1
  Private Const VER_PLATFORM_WIN32s = 0
    
    
  Private Sub Command1_Click()
          Dim len5     As Long, aa       As Long
          Dim cmprName     As String
          Dim osver     As OSVERSIONINFO
          '取得Computer   Name
          cmprName = String(255, 0)
          len5 = 256
          aa = GetComputerName(cmprName, len5)
          cmprName = Left(cmprName, InStr(1, cmprName, Chr(0)) - 1)
          Computer = cmprName                     '取得CPU端口号
          Set CPUs = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2").ExecQuery("select   *   from   Win32_Processor")
          For Each mycpu In CPUs
              Text1.Text = mycpu.ProcessorId
          Next
  End Sub

⌨️ 快捷键说明

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