sysinfo.bas
来自「关于WINSOCK控件基本编程的例程,提供电子邮件例程」· BAS 代码 · 共 39 行
BAS
39 行
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 + =
减小字号Ctrl + -
显示快捷键?