Easiest way to get main MAC address
A simple function to get PC's MAC address
AI
AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
源代码
Private Function GetMACAddress() As String
Dim Devices As Object
Dim Device As Object
Dim Temp As Variant
Dim Info As String
Set Devices = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapter")
For Each Device In Devices
For Each Temp In Device.Properties_
If Temp.Name = "MACAddress" Then GetMACAddress = CStr(Temp): Exit Function
Next
Next Device
End Function
原始评论 (3)
从 Wayback Machine 恢复