by Adam Melton (5 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 25th February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Finds the Hard Drive Serial Number, Motherboard Serial Number, Local HostName, Local Ip, Local port, And Includes A Function so you can add
'5 labels (label1-5)
'1 command button (command1)
'1 winsock (winsock1)
'to get winsock goto project, components,Microsoft Winsock Controls 6.0
Option Explicit
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 objs
Dim obj
Dim WMI
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_BaseBoard")
For Each obj In objs
label2.Caption = "MotherBoard Num: " & obj.SerialNumber
Next
Label1.Caption = "HDD Serial Num: " & GetSerialNumber("C:\")
label3.Caption = "Local IP Address: " & Winsock1.LocalIP
label4.Caption = "Local Host Name: " & Winsock1.LocalHostName
label5.Caption = "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
No comments have been posted about Finds the Hard Drive Serial Number, Motherboard Serial Number, Local HostName, Local Ip, Local port. Why not be the first to post a comment about Finds the Hard Drive Serial Number, Motherboard Serial Number, Local HostName, Local Ip, Local port.