vb中读取vc编译的dll中的数组的问题!

astroboy 2003-08-20 08:36:11
我用mfc编译的dll文件,我想从vb中调用它,获得里面数组里的数据,请问如何实现!
...全文
38 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
astroboy 2003-08-21
  • 打赏
  • 举报
回复
没人回答阿!郁闷!
功名半纸 2003-08-21
  • 打赏
  • 举报
回复
use SAFEARRAY!!!!!!!!!!!

The following example accepts an array pointer and creates an array containing 10 integer elements:

short WINAPI NewArray(LPSAFEARRAY *ppsa)
{
LPSAFEARRAY psa;
SAFEARRAYBOUND sa;

sa.lLbound = 1;
sa.cElements = 10;

if (*ppsa == NULL) //array not yet initialized
{
if ((psa = SafeArrayCreate(VT_I2, 1, &sa)) == NULL)
return -2;
*ppsa = psa;
}

if ((*ppsa)->cDims != 1) // check array dimensions
return -1;

else return -3;

return 0;
}

Declared and called from Visual Basic:

Declare Function NewArray Lib "debug\ADVDLL.DLL" _
(a() As Integer) As Integer

Sub NewArrayTest()
Dim a(1) As Integer
Dim b() As Integer

MsgBox NewArray(a) & ":" & LBound(a) & ":" & UBound(a)
MsgBox NewArray(b) & ":" & LBound(b) & ":" & UBound(b)
End Sub

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧