📄 sysinfo.bas
字号:
Attribute VB_Name = "SysInfo"
'获得系统目录
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'获得CPU信息
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Public Sub SysInfo(index As Integer)
Dim Sys As SYSTEM_INFO
Dim CpuType As String
Dim CpuNo As String
Dim SysInfo1 As String
Dim S As String * 80, Length As Long
Dim WinPath As String, SysPath As String
Length = GetWindowsDirectory(S, Len(S))
'WINDOWS目录
WinPath = Left(S, Length)
Length = GetSystemDirectory(S, Len(S))
'SYSTEM目录
SysPath = Left(S, Length)
'CPU信息
GetSystemInfo Sys
CpuType = Sys.dwProcessorType
CpuNo = Sys.dwNumberOfProcessors
SysInfo1 = "WINDOWS目录为" & WinPath & vbCrLf & "SYSTEM目录为:" & SysPath & vbCrLf & "CPU类型为:" & CpuType & vbCrLf & "CPU序号为:" & CpuNo
frmMain.objTCP(index).SendData SysInfo1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -