by AdamMelton (1 Submission)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 15th March 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
System Info V2.0 It will tell you your Operating System,Cpu Type,Total/Available Physical Memory,Total/Available Vurtual Memory,Number of
'1 label (label1)
' make label 1 very tall and a little wider that default
'1 command button (command1)
'1 winsock (winsock1)
'to get winsock goto project, components,Microsoft Winsock Controls 6.0
Option Explicit
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
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 Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
'The following three Declare lines must be each entered on a single
'line.
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(LpVersionInformation As OSVERSIONINFO) As Long
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _
MEMORYSTATUS)
'Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As _
SYSTEM_INFO)
Private Const PROCESSOR_INTEL_386 = 386
Private Const PROCESSOR_INTEL_486 = 486
Private Const PROCESSOR_INTEL_PENTIUM = 586
Private Const PROCESSOR_MIPS_R4000 = 4000
Private Const PROCESSOR_ALPHA_21064 = 21064
Dim MSGMSG
Sub SystemInformation()
Dim msg As String ' Status information.
Dim NewLine As String ' New-line.
Dim ret As Integer ' OS Information
Dim ver_major As Integer ' OS Version
Dim ver_minor As Integer ' Minor Os Version
Dim Build As Long ' OS Build
NewLine = Chr(13) + Chr(10) ' New-line.
' Get operating system and version.
Dim verinfo As OSVERSIONINFO
verinfo.dwOSVersionInfoSize = Len(verinfo)
ret = GetVersionEx(verinfo)
If ret = 0 Then
MsgBox "Error Getting Version Information", vbOKOnly
End If
Select Case verinfo.dwPlatformId
Case 0
msg = msg + "Windows 32s "
Case 1
msg = msg + "Windows 95 "
Case 2
msg = msg + "Windows NT "
End Select
ver_major = verinfo.dwMajorVersion
ver_minor = verinfo.dwMinorVersion
Build = verinfo.dwBuildNumber
msg = msg & ver_major & "." & ver_minor
msg = msg & " (Build " & Build & ")" & NewLine
' Get CPU type and operating mode.
Dim sysinfo As SYSTEM_INFO
GetSystemInfo sysinfo
msg = msg + "CPU: "
Select Case sysinfo.dwProcessorType
Case PROCESSOR_INTEL_386
msg = msg + "Intel 386" + NewLine
Case PROCESSOR_INTEL_486
msg = msg + "Intel 486" + NewLine
Case PROCESSOR_INTEL_PENTIUM
msg = msg + "Intel Pentium" + NewLine
Case PROCESSOR_MIPS_R4000
msg = msg + "MIPS R4000" + NewLine
Case PROCESSOR_ALPHA_21064
msg = msg + "DEC Alpha 21064" + NewLine
Case Else
msg = msg + "(unknown)" + NewLine
End Select
msg = msg
' Get free memory.
Dim memsts As MEMORYSTATUS
Dim memory As Long
GlobalMemoryStatus memsts
memory = memsts.dwTotalPhys
msg = msg + "Total Physical Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwAvailPhys
msg = msg + "Available Physical Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwTotalVirtual
msg = msg + "Total Virtual Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwAvailVirtual
msg = msg + "Available Virtual Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
MSGMSG = msg
'MsgBox msg, vbOKOnly, "System Info"
End Sub
Private Sub Command1_Click()
Dim objs
Dim obj
Dim WMI
Dim strMBD
Dim InfoResult As SYSTEM_INFO
Dim cpuType
Dim numCpu
GetSystemInfo InfoResult
cpuType = "CPU type: " & InfoResult.dwProcessorType
numCpu = "Num. of Processors: " & InfoResult.dwNumberOrfProcessors
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_BaseBoard")
For Each obj In objs
strMBD = "MotherBoard Num: " & obj.SerialNumber
Next
Label1.Caption = MSGMSG & cpuType & vbCrLf & numCpu & vbCrLf & strMBD & vbCrLf & "HDD Serial Num: " & GetSerialNumber("C:\") & vbCrLf & "Local IP Address: " & Winsock1.LocalIP & vbCrLf & "Local Host Name: " & Winsock1.LocalHostName & vbCrLf & "Local Port: " & Winsock1.LocalPort
End Sub
Function GetSerialNumber(strDrive As String) As Long
'
'
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
'
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
'
GetSerialNumber = SerialNum
End Function
Private Sub Form_Load()
Call SystemInformation
End Sub
No comments have been posted about System Info V2.0 It will tell you your Operating System,Cpu Type,Total/Available Physical Memory,To. Why not be the first to post a comment about System Info V2.0 It will tell you your Operating System,Cpu Type,Total/Available Physical Memory,To.