| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2053 人关注过本帖
标题:VB窗体损坏怎么办
取消只看楼主 加入收藏
leziyi
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2016-10-30
结帖率:85.71%
收藏
已结贴  问题点数:30 回复次数:3 
VB窗体损坏怎么办
我在帮同学开发一个防火墙,有一天我按Ctrl+S保存程序,关掉电脑睡觉
第二天起来打开程序提示主窗体加载错误,我点确认,一看工程资源管理器,主窗体不翼而飞,用记事本打开主窗体文件一看,文件空了,但资源管理器里显示有21KB大小
请各位兄弟帮忙解决一下,下附附件:
VB防火墙.zip (7.47 KB)
搜索更多相关主题的帖子: VB 窗体 损坏 打开 资源管理器 
2018-12-05 20:08
leziyi
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2016-10-30
收藏
得分:0 
顺便帮忙看一下这段代码:
程序代码:

Call GetTcpTable(ByVal0&, cbRequired, 1)


显示错误:用户定义类型不能用
改成ByRef后显示错误:用户类型未定义
2018-12-06 20:51
leziyi
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2016-10-30
收藏
得分:0 
函数声明:
程序代码:

'GetTcpTable函数能返回当前系统中全部有效的 TCP连接

Declare Function GetTcpTable Lib "iphlpapi.dll" (ByRef pTcpTable As MIB_TCPTABLE, ByRef pdwSize As Long, ByVal bOrder As Long) As Long



程序代码:

Call GetTcpTable(ByVal 0&, cbRequired, 1)

2018-12-07 12:41
leziyi
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2016-10-30
收藏
得分:0 
帮忙看一下:
Private Sub GetTcpDatas()

  Dim tcpt As MIB_TCPTABLE

  Dim TcpRow     As MIB_TCPROW

  Dim Buffer()     As Byte

  Dim LngRequired     As Long

  Dim LngStructureSize     As Long

  Dim LngRows     As Long

  Dim LngCounter     As Long

  Dim strTemps     As String

  Dim ListX     As ListItem

   

  LvwTcpTable.ListItems.Clear

  GetTcpTable tcpt, LngRequired, 1

   

  If LngRequired > 0 Then

          ReDim Buffer(0 To LngRequired - 1) As Byte

          If GetTcpTable(Buffer(0), LngRequired, 1) = ERROR_SUCCESS Then

                  LngStructureSize = LenB(TcpRow)

   

                  '起始的四个字节,是做为表示进入点的数字

                  CopyMemory LngRows, Buffer(0), 4

                  For LngCounter = 1 To LngRows

   

                          '   将上述获得四个字节的相关数据,拷贝到   TcpRow   的结构之中

                          CopyMemory TcpRow, Buffer(4 + (LngCounter - 1) * LngStructureSize), LngStructureSize

                           

                          '   将结果传送到   ListView   之中

                          With TcpRow

                                  Set ListX = ListView1.ListItems.Add(, , GetInetAddrStr(.dwLocalAddr))

                                  ListX.SubItems(1) = ntohs(.dwLocalPort)

                                  ListX.SubItems(2) = GetInetAddrStr(.dwRemoteAddr)

                                  ListX.SubItems(3) = ntohs(.dwRemotePort)

                                  ListX.SubItems(4) = (.dwState)

                                  Select Case .dwState

                                          Case MIB_TCP_STATE_CLOSE_WAIT:         strTemps = "结束等待"

                                          Case MIB_TCP_STATE_CLOSED:                 strTemps = "已结束"

                                          Case MIB_TCP_STATE_CLOSING:               strTemps = "结束中..."

                                          Case MIB_TCP_STATE_DELETE_TCB:         strTemps = "已删除TCB"

                                          Case MIB_TCP_STATE_ESTAB:                   strTemps = "已连接"

                                          Case MIB_TCP_STATE_FIN_WAIT1:           strTemps = "FIN延时处理1"

                                          Case MIB_TCP_STATE_FIN_WAIT2:           strTemps = "FIN延时处理2"

                                          Case MIB_TCP_STATE_LAST_ACK:             strTemps = "上次取得的确认信号"

                                          Case MIB_TCP_STATE_LISTEN:                 strTemps = "监听中..."

                                          Case MIB_TCP_STATE_SYN_SENT:             strTemps = "传送"

                                          Case MIB_TCP_STATE_SYN_RCVD:             strTemps = "数据接收中"

                                          Case MIB_TCP_STATE_TIME_WAIT:           strTemps = "等候中..."

                                  End Select

                                  ListX.SubItems(4) = ListX.SubItems(4) & "(" & strTemps & ")"

                                  strTemps = ""

                          End With

                    

                  Next

            

          End If

  End If

   

  End Sub
---------------------------
Microsoft Visual Basic
---------------------------
编译错误:

ByRef 参数类型不符
---------------------------
确定   帮助   
---------------------------
2018-12-08 11:09
快速回复:VB窗体损坏怎么办
数据加载中...
 
   



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

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