vc6.0写的 CodeLib.dll 里有一这样的函数:
int searchmachine (Byte cPort,Dword dwBaudRate,Byte cStar,byte cEnd,char *pSearchResult)
我在VB中这样声明:
 Declare Function SearchMachine Lib "CodeLib.dll" (ByVal cPort As Byte, ByVal dwBaudRate As Long, ByVal cStar As Byte, ByVal cEnd As Byte, ByRef pSearchResult As Byte) As Integer
然后在一处这样调用:
dim i as integer
dim cpor as byte
dim k as byte
dim cmachineno(4) as byte
cpor=1
k=4
 i = SearchMachine(cpor, dwBaudRate, 0, k, cmachineno(0))
结果为:I为0说明正确执行
且cmachineno()数组里也得出了想要的结果.
可是当关闭整个VB时出现了这样的情况:
内存不能为"written"
如果生成exe执行,也会出现这样的情况
是什么原因呢?请高手们帮忙,只要用到带有指针的函数都会出现那样的情况