Imports System.Management
Public Class Form1
Private Function Get_Motherboard_Sno() As String
Dim mc As Ne34w Class("Win32_BaseBoard") ' 註1
mc.Scope.Options.EnablePrivileges = True ' 註2
Dim sno As String = ""
For Each mo As Object In mc.GetInstances() ' 註3
sno = mo("SerialNumber") ' 註4
Next
mc.Dispose() ' 註5
Return sno
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("硬碟序號: " & Get_HD_Sno(0) & _
ControlChars.CrLf & ControlChars.CrLf & _
"主機板序號: " & Get_Motherboard_Sno())
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
ˋ