| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2399 人关注过本帖
标题:VB编译错误:局部,非静态变量太多
取消只看楼主 加入收藏
时光流逝
Rank: 4
来 自:北京
等 级:业余侠客
威 望:8
帖 子:94
专家分:297
注 册:2019-11-16
结帖率:100%
收藏
已结贴  问题点数:50 回复次数:2 
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


这是什么奇奇怪怪的错误我就定义了一个数组,两个局部变量而已,至于吗?我以前一个过程里定义几十个静态变量都没出过这个错
搜索更多相关主题的帖子: End ListView Public Type Long 
2020-12-06 22:54
时光流逝
Rank: 4
来 自:北京
等 级:业余侠客
威 望:8
帖 子:94
专家分:297
注 册:2019-11-16
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

2020-12-06 22:57
时光流逝
Rank: 4
来 自:北京
等 级:业余侠客
威 望:8
帖 子:94
专家分:297
注 册:2019-11-16
收藏
得分:0 
回复 3楼 风吹过b
谢谢
2020-12-07 21:19
快速回复:VB编译错误:局部,非静态变量太多
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016480 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved