⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 网卡地址.frm

📁 Windows API函数,希望大伙有用哦
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1170
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3870
   LinkTopic       =   "Form1"
   ScaleHeight     =   1170
   ScaleWidth      =   3870
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Alignment       =   2  'Center
      Height          =   315
      Left            =   1830
      TabIndex        =   1
      Top             =   210
      Width           =   1845
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退  出"
      Height          =   315
      Left            =   2790
      TabIndex        =   0
      Top             =   660
      Width           =   825
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "本机网卡物理地址:"
      Height          =   180
      Left            =   150
      TabIndex        =   2
      Top             =   240
      Width           =   1620
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' 字符常数说明
Private Const NCBASTAT = &H33
Private Const NCBNAMSZ = 16
Private Const HEAP_ZERO_MEMORY = &H8
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
Private Const NCBRESET = &H32
' 结构型变量说明
Private Type NCB
  NCB_Command As Byte
  NCB_Buffer As Long
  NCB_Length As Integer
  NCB_CallName As String * NCBNAMSZ
  NCB_Lana_Num As Byte
 End Type
Private Type ADAPTER_STATUS
  Adapter_Address(5) As Byte
End Type
Private Type NAME_BUFFER
  Name As String * NCBNAMSZ
  Name_Num As Integer
  Name_Flags As Integer
End Type
Private Type ASTAT
  Adapt As ADAPTER_STATUS
  NameBuff(30) As NAME_BUFFER
End Type
' API函数声明
Private Declare Function Netbios Lib "netapi32.dll" (pNCB As NCB) As Byte
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Private Sub Form_Load()
  Dim myNCB As NCB
  Dim myASTAT As ASTAT, TempASTAT As ASTAT
  Dim Pastat As Long
    myNCB.NCB_Command = NCBRESET
    Netbios myNCB
    myNCB.NCB_Command = NCBASTAT
    myNCB.NCB_Lana_Num = 0
    myNCB.NCB_CallName = "*"
    myNCB.NCB_Length = Len(myASTAT)
    Pastat = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, myNCB.NCB_Length)
    myNCB.NCB_Buffer = Pastat
    Netbios myNCB
    CopyMemory myASTAT, myNCB.NCB_Buffer, Len(myASTAT)
    Text1 = Hex(myASTAT.Adapt.Adapter_Address(0)) & "-" & Hex(myASTAT.Adapt.Adapter_Address(1)) & "-" & Hex(myASTAT.Adapt.Adapter_Address(2)) & "-" & Hex(myASTAT.Adapt.Adapter_Address(3)) & "-" & Hex(myASTAT.Adapt.Adapter_Address(4)) & "-" & Hex(myASTAT.Adapt.Adapter_Address(5))
    HeapFree GetProcessHeap(), 0, Pastat
End Sub
Private Sub Command1_Click()
   Unload Me
   End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -