程序語言
運行平台
功能描述
步驟
Option Explicit
Private Const NCBASTAT = &H
Private Const NCBNAMSZ =
Private Const HEAP_ZERO_MEMORY = &H
Private Const HEAP_GENERATE_EXCEPTIONS = &H
Private Const NCBRESET = &H
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(
ncb_event As Long
End Type
Private Type ADAPTER_STATUS
adapter_address(
rev_major As Byte
reserved
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
t
ti_timeouts As Integer
Reserved
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(
End Type
Private Declare Function Netbios Lib
Private Declare Sub CopyMemory Lib
(hpvDest As Any
Private Declare Function GetProcessHeap Lib
Private Declare Function HeapAlloc Lib
(ByVal hHeap As Long
ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib
ByVal dwFlags As Long
把下面的代碼放入Command
Private Sub Command
Dim myNcb As NCB
Dim bRet As Byte
myNcb
bRet = Netbios(myNcb)
myNcb
myNcb
myNcb
Dim myASTAT As ASTAT
Dim pASTAT As Long
myNcb
Debug
pASTAT = HeapAlloc(GetProcessHeap()
Or HEAP_ZERO_MEMORY
If pASTAT =
Debug
Exit Sub
End If
myNcb
bRet = Netbios(myNcb)
Debug
CopyMemory myASTAT
MsgBox Hex(myASTAT
Hex(myASTAT
&
& Hex(myASTAT
&
& Hex(myASTAT
HeapFree GetProcessHeap()
End Sub
From:http://tw.wingwit.com/Article/program/net/201311/12061.html