本帖最后由 飘云 于 2011-5-1 17:46 编辑
在vb中只要
Private Type MIB_IFTABLE
dwNumEntries As Long
MIB_Table(9) As MIB_IFROW
End Type
这样就定义了MIB_IFTABLE数据结构,然后
Dim ifT As MIB_IFTABLE
LenIfT = Len(ifT)
RValue = GetIfTable(ifT, LenIfT, True)
之后,ifT.dwNumEntries就有结果了,在au3中该怎么写以便获取dwNumEntries的值呢?
试着写了下
$MIB_IFROW = DllStructCreate("wchar wszName[256];dword dwIndex;dword dwType;dword dwMtu;dword dwSpeed;dword dwPhysAddrLen;char bPhysAddr[8];dword dwAdminStatus;dword dwOperStatus;dword dwLastChange;dword dwInOctets;dword dwInUcastPkts;dword dwInNUcastPkts;dword dwInDiscards;dword dwInErrors;dword dwInUnknownProtos;dword dwOutOctets;dword dwOutUcastPkts;dword dwOutNUcastPkts;dword dwOutDiscards;dword dwOutErrors;dword dwOutQLen;dword dwDescrLen;char bDescr[256]")
$MIB_IFTABLE = DllStructCreate("dword;ptr")
DllStructSetData($MIB_IFTABLE,2,DllStructGetPtr($MIB_IFROW))
DllCall("iphlpapi.dll","dword","GetIfTable","ptr",DllStructGetPtr($MIB_IFTABLE),"dword",DllStructGetSize($MIB_IFTABLE),"BOOL",1)
MsgBox(0,"",DllStructGetData($MIB_IFTABLE,1))
但是以上代码一运行编译器就报错 |