关于VC的DLL与VB数据传递 请问高手,怎样在VC的DLL里返回一个整型数组让VB接收,多谢指教,最好能给一个例子,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你在vb的部件中引用它然后 dim a as 那个部件 set a = new 那个部件就可以了 参数可以a.什么什么就行了 #include <windows.h>#include <oleauto.h>//complier comment: cl NewLongs.cpp /LD kernel32.lib oleaut32.libextern "C" __declspec(dllexport) short __stdcall NewArray(LPSAFEARRAY *ppsa){ LPSAFEARRAY psa; SAFEARRAYBOUND sa; sa.lLbound = 1; sa.cElements = 10; if (*ppsa == NULL) //没有初始化 { if ((psa = SafeArrayCreate(VT_I2, 1, &sa)) == NULL) return -2; *ppsa = psa; } if ((*ppsa)->cDims != 1) // 检查数组的维数(1维数组) return -1; else return -3; return 0;}Private Declare Function NewIntArray Lib "NewLongs.dll" Alias "_NewArray@4" (FistElement() As Integer) As LongVBDim a(1) As IntegerDim b() As IntegerMsgBox NewIntArray(a) & ": " & LBound(a) & " : " & UBound(a)MsgBox NewIntArray(b) & ": " & LBound(b) & " : " & UBound(b) mfc如何向listctrl中添加一行数据 VC如何实现全屏背景? CListCtrl列表头多行显示 出售各种音频、视频的CODEC 求CFileFind类的FindFile(LPCSTR str,DWORD )的用法 VC++ 中ADO & DBF的 若干难题!!!!!!! 自定义的控件如何改变自身的高度 高分学艺:CSocket中,如何设置客户端的超时CONNECT! 借花献佛 ------- InstallShield WIN98 输入法的问题? VC中有没有得到毫秒级时间的函数? 急需帮助,关于串口通讯的的问题。
然后 dim a as 那个部件
set a = new 那个部件就可以了
参数可以a.什么什么就行了
#include <oleauto.h>
//complier comment: cl NewLongs.cpp /LD kernel32.lib oleaut32.lib
extern "C" __declspec(dllexport) short __stdcall NewArray(LPSAFEARRAY *ppsa)
{
LPSAFEARRAY psa;
SAFEARRAYBOUND sa; sa.lLbound = 1;
sa.cElements = 10; if (*ppsa == NULL) //没有初始化
{
if ((psa = SafeArrayCreate(VT_I2, 1, &sa)) == NULL)
return -2;
*ppsa = psa;
} if ((*ppsa)->cDims != 1) // 检查数组的维数(1维数组)
return -1; else return -3;
return 0;
}Private Declare Function NewIntArray Lib "NewLongs.dll" Alias "_NewArray@4" (FistElement() As Integer) As LongVB
Dim a(1) As Integer
Dim b() As IntegerMsgBox NewIntArray(a) & ": " & LBound(a) & " : " & UBound(a)
MsgBox NewIntArray(b) & ": " & LBound(b) & " : " & UBound(b)