Advertisement
6_2008-2009 Windows System Services #214718

Easiest way to get main MAC address

A simple function to get PC's MAC address

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.

كود المصدر
original-source
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