VB编译错误:局部,非静态变量太多
程序代码:
Private Const Any_Size = 128 Private Const AF_INET = 2 Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) '定义一些TCP协议 Public Type MIB_TCP6ROW_OWNER_PID dwLocalAddr(16) As String dwLocalScopeId As Long dwLocalPort As Long dwRemoteAddr(16) As String dwRemoteScopeId As Long dwRemotePort As Long dwState As Long dwOwningPid As Long End Type Public Type MIB_TCP6TABLE_OWNER_PID dwNumEntries As Long TcpTable(Any_Size) As MIB_TCP6ROW_OWNER_PID End Type Public Enum TCP_TABLE_CLASS TCP_TABLE_BASIC_LISTENER TCP_TABLE_BASIC_CONNECTIONS TCP_TABLE_BASIC_ALL TCP_TABLE_OWNER_PID_LISTENER TCP_TABLE_OWNER_PID_CONNECTIONS TCP_TABLE_OWNER_PID_ALL TCP_TABLE_OWNER_MODULE_LISTENER TCP_TABLE_OWNER_MODULE_CONNECTIONS TCP_TABLE_OWNER_MODULE_ALL End Enum '定义一些UDP协议 Public Type MIB_UDP6ROW_OWNER_PID dwLocalAddr(16) As String dwLocalScopeId As Long dwLocalPort As Long dwRemoteAddr(16) As String dwRemoteScopeId As Long dwRemotePort As Long dwState As Long dwOwningPid As Long End Type Public Type MIB_UDP6TABLE_OWNER_PID dwNumEntries As Long UdpTable(Any_Size) As MIB_UDP6ROW_OWNER_PID End Type Public Enum UDP_TABLE_CLASS UDP_TABLE_BASIC_LISTENER UDP_TABLE_BASIC_CONNECTIONS UDP_TABLE_BASIC_ALL UDP_TABLE_OWNER_PID_LISTENER UDP_TABLE_OWNER_PID_CONNECTIONS UDP_TABLE_OWNER_PID_ALL UDP_TABLE_OWNER_MODULE_LISTENER UDP_TABLE_OWNER_MODULE_CONNECTIONS UDP_TABLE_OWNER_MODULE_ALL End Enum '定义一些ICMP协议 Public MIBICMPSTATS As MIBICMPSTATS Public Type MIBICMPSTATS dwEchos As Long dwEchoReps As Long End Type Public MIBICMPINFO As MIBICMPINFO Public Type MIBICMPINFO icmpOutStats As MIBICMPSTATS End Type Public MIB_ICMP As MIB_ICMP Public Type MIB_ICMP stats As MIBICMPINFO End Type Public Declare Function GetExtendedTcpTable Lib "iphlpapi.dll" (pTcpTable As MIB_TCP6TABLE_OWNER_PID, pdwSize As Long, bOrder As Boolean, ulAf As Long, TableClass As TCP_TABLE_CLASS, Reserved As Long) As Long Public Declare Function GetExtendedUdpTable Lib "iphlpapi.dll" (pUdpTable As MIB_UDP6TABLE_OWNER_PID, pdwSize As Long, bOrder As Boolean, ulAf As Long, TableClass As UDP_TABLE_CLASS, Reserved As Long) As Long '定义连接状态为13个 Public IP_States(13) As String Public Sub GetTcpTable(ListView As ListView) On Error Resume Next Dim TcpTable As MIB_TCP6TABLE_OWNER_PID, i As Long GetExtendedTcpTable TcpTable, Len(TcpTable), True, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0 For i = 0 To TcpTable.dwNumEntries ListView.ListItems.Add , "x" & i, TcpTable.TcpTable(i).dwOwningPid ListView.ListItems(ListView.ListItems.Count).SubItems(1) = TcpTable.TcpTable(i).SrcIP ListView.ListItems(ListView.ListItems.Count).SubItems(2) = TcpTable.TcpTable(i).DesIP ListView.ListItems(ListView.ListItems.Count).SubItems(3) = TcpTable.TcpTable(i).SrcPort ListView.ListItems(ListView.ListItems.Count).SubItems(4) = TcpTable.TcpTable(i).DesPort ListView.ListItems(ListView.ListItems.Count).SubItems(5) = ModNetstat.IP_States(TcpTable.TcpTable(i).SrcIP) Next End Sub
这是什么奇奇怪怪的错误我就定义了一个数组,两个局部变量而已,至于吗?我以前一个过程里定义几十个静态变量都没出过这个错