Search Tools Links Login

Easiest way to get main MAC address


Visual Basic 6, or VB Classic

A simple function to get PC's MAC address

Original Author: Haytham Khalil

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 123 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.