各位大神,江湖求救!!求一个Lotus script取客户端网卡Mac地址,

各位大神,紧急求一个Lotus script取客户端网卡Mac地址的,我在网上找到一个vb的例子,在VB上没有问题,但在lotus环境怎么都取不到,请大神帮忙!!! 悬赏50啊,有木有!!!

'Downlod by http://www.codefans.net
Option Explicit

Public CheckCode As Long

Private Const NCBASTAT                       As Long = &H33
Private Const NCBNAMSZ                       As Integer = 16
Private Const HEAP_ZERO_MEMORY               As Long = &H8
Private Const HEAP_GENERATE_EXCEPTIONS       As Long = &H4
Private Const NCBRESET                       As Long = &H32
Private Type NCB
    ncb_command                                As Byte
    ncb_retcode                                As Byte
    ncb_lsn                                    As Byte
    ncb_num                                    As Byte
    ncb_buffer                                 As Long
    ncb_length                                 As Integer
    ncb_callname                               As String * NCBNAMSZ
    ncb_name                                   As String * NCBNAMSZ
    ncb_rto                                    As Byte
    ncb_sto                                    As Byte
    ncb_post                                   As Long
    ncb_lana_num                               As Byte
    ncb_cmd_cplt                               As Byte
    ncb_reserve(9)                             As Byte
    ncb_event                                  As Long
End Type
Private Type ADAPTER_STATUS
    adapter_address(5)                         As Byte
    rev_major                                  As Byte
    reserved0                                  As Byte
    adapter_type                               As Byte
    rev_minor                                  As Byte
    duration                                   As Integer
    frmr_recv                                  As Integer
    frmr_xmit                                  As Integer
    iframe_recv_err                            As Integer
    xmit_aborts                                As Integer
    xmit_success                               As Long
    recv_success                               As Long
    iframe_xmit_err                            As Integer
    recv_buff_unavail                          As Integer
    t1_timeouts                                As Integer
    ti_timeouts                                As Integer
    Reserved1                                  As Long
    free_ncbs                                  As Integer
    max_cfg_ncbs                               As Integer
    max_ncbs                                   As Integer
    xmit_buf_unavail                           As Integer
    max_dgram_size                             As Integer
    pending_sess                               As Integer
    max_cfg_sess                               As Integer
    max_sess                                   As Integer
    max_sess_pkt_size                          As Integer
    name_count                                 As Integer
End Type
Private Type NAME_BUFFER
    name                                       As String * NCBNAMSZ
    name_num                                   As Integer
    name_flags                                 As Integer
End Type

Private Type NAME_BUFFER1
    name                                       As String * NCBNAMSZ
End Type

Private Type NAME_BUFFER11
    name_num                                   As Integer
    name_flags                                 As Integer
End Type

Private Type NAME_BUFFER2
    name_num                                   As Integer
End Type

Private Type NAME_BUFFER3

    name_flags                                 As Integer
End Type

Private Type ASTAT21

    NameBuff(30)                               As NAME_BUFFER1
End Type

Private Type ASTAT22

    NameBuff(30)                               As NAME_BUFFER2
End Type

Private Type ASTAT23

    NameBuff(30)                               As NAME_BUFFER3
End Type


Private Type ASTAT
    adapt                                      As ADAPTER_STATUS
    NameBuff(30)                               As NAME_BUFFER
End Type


Private Type ASTAT1
    adapt                                      As ADAPTER_STATUS
End Type

Private Type ASTAT2

    NameBuff(30)                               As NAME_BUFFER
End Type

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


Public Function GetMACAddress() As String


  Dim bRet    As Byte
  Dim myNcb   As NCB
  Dim myASTAT As ASTAT
  Dim myASTAT1 As ASTAT1
  Dim ASTAT21 As ASTAT21

    Dim myASTAT21 As ASTAT21
    Dim myASTAT22 As ASTAT22
        Dim myASTAT23 As ASTAT23

  Dim my
  Dim pASTAT  As Long
  Dim a As Long
  Dim b As Long
  Dim c As Long
    Dim e As Long
  Dim f As Long

      c = Len(myNcb)

    myNcb.ncb_command = NCBRESET
    e = Len(myNcb.ncb_name)
    f = Len(myNcb.ncb_callname)

    bRet = Netbios(myNcb)

        e = Len(myNcb.ncb_name)
    f = Len(myNcb.ncb_callname)

    a = Len(myASTAT1)
    b = Len(myASTAT21)
    c = Len(myNcb)
    With myNcb
        .ncb_command = NCBASTAT
        .ncb_lana_num = 0
        .ncb_callname = "* "
        .ncb_length = Len(myASTAT)
        pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, .ncb_length)
    End With
    If pASTAT = 0 Then
        Exit Function
    End If
    myNcb.ncb_buffer = pASTAT
    bRet = Netbios(myNcb)
    CopyMemory myASTAT, myNcb.ncb_buffer, Len(myASTAT)
    GetMACAddress = HexEx(myASTAT.adapt.adapter_address(0)) & "-" & HexEx(myASTAT.adapt.adapter_address(1)) & "-" & HexEx(myASTAT.adapt.adapter_address(2)) & "-" & HexEx(myASTAT.adapt.adapter_address(3)) & "-" & HexEx(myASTAT.adapt.adapter_address(4)) & "-" & HexEx(myASTAT.adapt.adapter_address(5))
    Call HeapFree(GetProcessHeap(), 0, pASTAT)

End Function

Private Function HexEx(ByVal b As Long) As String

  Dim aa As String

    aa = Hex$(b)
    If Len(aa) < 2 Then
        aa = "0" & aa
    End If
    HexEx = aa

End Function
参与7

6同行回答

aili1wanaili1wan软件开发工程师广州瑞星
以下代码调试已过,xp环境Private Const NCBASTAT = &H33Private Const NCBNAMSZ = 16Private Const HEAP_ZERO_MEMORY = &H8Private Const HEAP_GENERATE_EXCEPTIONS = &H4Private Const NCBRESET = &H32Private Type NCB        ncb_command As Byte...显示全部
以下代码调试已过,xp环境

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_retcode As Byte
        ncb_lsn As Byte
        ncb_num As Byte
        ncb_buffer As Long
        ncb_length As Integer
        ncb_callname As String * NCBNAMSZ
        ncb_name As String * NCBNAMSZ
        ncb_rto As Byte
        ncb_sto As Byte
        ncb_post As Long
        ncb_lana_num As Byte
        ncb_cmd_cplt As Byte
        ncb_reserve(9) As Byte ' Reserved, must be 0
        ncb_event As Long
End Type

Private Type ADAPTER_STATUS
        adapter_address(5) As Byte
        rev_major As Byte
        reserved0 As Byte
        adapter_type As Byte
        rev_minor As Byte
        duration As Integer
        frmr_recv As Integer
        frmr_xmit As Integer
        iframe_recv_err As Integer
        xmit_aborts As Integer
        xmit_success As Long
        recv_success As Long
        iframe_xmit_err As Integer
        recv_buff_unavail As Integer
        t1_timeouts As Integer
        ti_timeouts As Integer
        Reserved1 As Long
        free_ncbs As Integer
        max_cfg_ncbs As Integer
        max_ncbs As Integer
        xmit_buf_unavail As Integer
        max_dgram_size As Integer
        pending_sess As Integer
        max_cfg_sess As Integer
        max_sess As Integer
        max_sess_pkt_size As Integer
        name_count As Integer
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

Declare Function Netbios Lib "netapi32.dll" (pncb As NCB) As Byte
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, Byval hpvSource As Long, Byval cbCopy As Long)
Declare Function GetProcessHeap Lib "kernel32" () As Long
Declare Function HeapAlloc Lib "kernel32" (Byval hHeap As Long, Byval dwFlags As Long, Byval dwBytes As Long) As Long
Declare Function HeapFree Lib "kernel32" (Byval hHeap As Long, Byval dwFlags As Long, lpMem As Any) As Long

Sub Initialize
        Dim udtNCB As NCB
        Dim bytResponse As Byte
        Dim udtASTAT As ASTAT
        Dim udtTempASTAT As ASTAT
        Dim lngASTAT As Long
        Dim strOut As String
        Dim x As Integer
       
        udtNCB.ncb_command = NCBRESET
        bytResponse = Netbios(udtNCB)
        udtNCB.ncb_command = NCBASTAT
        udtNCB.ncb_lana_num = LanaNumber
        udtNCB.ncb_callname = "* "
        udtNCB.ncb_length = Len(udtASTAT)
        lngASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, udtNCB.ncb_length)
        strOut = ""
        If lngASTAT Then
                udtNCB.ncb_buffer = lngASTAT
                bytResponse = Netbios(udtNCB)
                CopyMemory udtASTAT, udtNCB.ncb_buffer, Len(udtASTAT)
                'With udtASTAT.adapt
                For x = 0 To 5
                        strOut = strOut & Right$("00" & Hex$(udtASTAT.adapt.adapter_address(x)), 2)
                Next x
                'End With
                HeapFree GetProcessHeap(), 0, lngASTAT
        End If
        EthernetAddress = strOut
       
        Msgbox EthernetAddress
End Sub收起
政府机关 · 2013-09-18
浏览876
spyxyspyxy系统运维工程师意能软件
win7下取出的怎么是00-00-00-00-00-00显示全部
win7下取出的怎么是00-00-00-00-00-00收起
软件开发 · 2013-09-17
浏览815
sepfoxsepfox项目经理ZTE
回复 4# ellismatao    谢谢回复,是CS客户端显示全部
回复 4# ellismatao


   谢谢回复,是CS客户端收起
系统集成 · 2013-09-16
浏览828
ellismataoellismatao软件开发工程师中国化工集团公司
你用lotusscript,是在bs端执行还是cs端执行?vb肯定就是类CS的执行。。。。显示全部
你用lotusscript,是在bs端执行还是cs端执行?vb肯定就是类CS的执行。。。。收起
互联网服务 · 2013-09-15
浏览878
sepfoxsepfox项目经理ZTE
回复 2# witlili    谢谢啊,不是IP地址,是MAC地址的,IP是没有问题的显示全部
回复 2# witlili


   谢谢啊,不是IP地址,是MAC地址的,IP是没有问题的收起
系统集成 · 2013-09-13
浏览811
witliliwitlili软件开发工程师神州数码
你调试以下程序。http://www-10.lotus.com/ldd/nd6f ... 4f86ab?OpenDocument显示全部
软件开发 · 2013-09-13
浏览885

提问者

sepfox
项目经理ZTE

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2013-09-13
  • 关注会员:1 人
  • 问题浏览:4271
  • 最近回答:2013-09-18
  • X社区推广