标题:模块中选择case语句中运行call命令错误,谁能提供解决方案
取消只看楼主
rogersgb
Rank: 1
等 级:新手上路
帖 子:73
专家分:0
注 册:2016-2-3
结帖率:47.37%
已结贴  问题点数:20 回复次数:1 
模块中选择case语句中运行call命令错误,谁能提供解决方案
VB拨号模块中Select选择case语句中运行call命令错误,错误提示:---------------------------
浙江国税VPDN专用拨号软件.exe - 应用程序错误
---------------------------
"0x734747f2" 指令引用的 "0x00000098" 内存。该内存不能为 "written"。

要终止程序,请单击“确定”。
要调试程序,请单击“取消”。
---------------------------
确定   取消   
---------------------------




谁能提供解决方案
搜索更多相关主题的帖子: 解决方案 拨号软件 应用程序 written 浙江 
2016-05-16 12:14
rogersgb
Rank: 1
等 级:新手上路
帖 子:73
专家分:0
注 册:2016-2-3
得分:0 
回复 2楼 ZHRXJR
异步拨号模块中   Case RASCS_Connected
       Form1.Label11.Caption = "连接成功!"
= False
= True
call start
    Case RASCS_Disconnected
       Form1.Label11.Caption = "连接已断开!"
End Select

start模块如下

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long

'获取IP地址
Private Const MAX_IP = 255

Private Type IPINFO
            dwAddr   As Long    'IP地址
            dwIndex   As Long
            dwMask   As Long    '掩码
            dwBCastAddr   As Long    '广播地址
            dwReasmSize   As Long
            unused1   As Integer
            unused2   As Integer
End Type


Private Type MIB_IPADDRTABLE
            dEntrys   As Long
            mIPInfo(MAX_IP)   As IPINFO
End Type
Private Type IP_Array
            mBuffer   As MIB_IPADDRTABLE
            BufferLen   As Long
End Type
Dim strIP     As String


Private Function ConvertAddressToString(longAddr As Long) As String
    Dim myByte(3)     As Byte
    Dim Cnt     As Long
    CopyMemory myByte(0), longAddr, 4
    For Cnt = 0 To 3
        ConvertAddressToString = ConvertAddressToString + CStr(myByte(Cnt)) + "."
    Next Cnt
    ConvertAddressToString = left$(ConvertAddressToString, Len(ConvertAddressToString) - 1)
End Function
Public Sub Start()

    Dim Ret     As Long, Tel       As Long
    Dim bBytes()     As Byte
    Dim Listing     As MIB_IPADDRTABLE

    On Error GoTo END1
    GetIpAddrTable ByVal 0&, Ret, True

    If Ret <= 0 Then Exit Sub

    ReDim bBytes(0 To Ret - 1) As Byte

    GetIpAddrTable bBytes(0), Ret, False
    CopyMemory Listing.dEntrys, bBytes(0), 4

    For Tel = 0 To Listing.dEntrys - 1
 CopyMemory Listing.mIPInfo(Tel), bBytes(4 + (Tel * Len(Listing.mIPInfo(0)))), Len(Listing.mIPInfo(Tel))
If InStr(1, ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr), "10.26") > 0 Or InStr(1, ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr), "10.6") > 0 Or InStr(1, ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr), "10.86") > 0 Then
 strIP = ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr)
        End If
    Next
Shell "route -p add 100.0.0.0 mask 255.255.255.0 " & strIP, vbHide
    Exit Sub
END1:
    MsgBox "ERROR"
   
End Sub



2016-05-17 08:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-464868-1-1.html




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

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