如何通過VB獲取網(wǎng)卡地址

字號:

1)在Visual Basic生成標準的EXE文件。缺省創(chuàng)建 Form1。
    2)在Form1中添加一命令按鈕,缺省名為Command1。
    3)把下列代碼放到Form1中說明部分。
    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 ´Integer
    ncb_retcode As Byte ´Integer
    ncb_lsn As Byte ´Integer
    ncb_num As Byte ´ Integer
    ncb_buffer As Long ´String
    ncb_length As Integer
    ncb_callname As String * NCBNAMSZ
    ncb_name As String * NCBNAMSZ
    ncb_rto As Byte ´Integer
    ncb_sto As Byte ´ Integer
    ncb_post As Long
    ncb_lana_num As Byte ´Integer
    ncb_cmd_cplt As Byte ´Integer
    ncb_reserve(9) As Byte ´ Reserved, must be 0
    ncb_event As Long
    End Type