首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

在线急求!vb6调用vc++生成的dll出现“在其上下文中,该请求的地址无效”,该如何处理

2012-03-24 
在线急求!vb6调用vc++生成的dll出现“在其上下文中,该请求的地址无效”vc++生成的Collector.dll,其中一个函

在线急求!vb6调用vc++生成的dll出现“在其上下文中,该请求的地址无效”
vc++生成的Collector.dll,其中一个函数是setConnect (byte ip[],int port)
我声明 
Private Declare Function SetConnectS Lib "Collector.dll" Alias "setConnect" (byref IP() As Byte, port As Long)

然后
Dim SerB() As Byte
Dim SerS As String
Dim Sp As Long
Dim i As Integer
SerS = "119.176.60.228"
SerB = SerS
Sp = 9090

SetConnectS SerB(), Sp
这里报错“在其上下文中,该请求的地址无效”
然后出现 
实时错误49
“dll调用约定错误”

这两个问题,我该怎么办?求高手详解,最好能写出正确代码,小弟拜谢!

[解决办法]
Private Declare Function SetConnectS Lib "Collector.dll" Alias "setConnect" (Byref IP As Byte, port As Long)

Dim SerB() As Byte
Dim SerS As String
Dim Sp As Long

SerS = "119.176.60.228" & Chr(0)
SerB = StrConv(SerS, vbFromUnicode)
Sp = 9090

SetConnectS SerB(0), Sp

热点排行