佚名通过本文主要向大家介绍了vb组件,vb6.0组件,vb调用com组件,vb com组件,vb.net 结构体等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 如何传递一个结构体从VC COM组件-〉NET VB程序???
描述:
描述:
struct tstruct_t {
int i;
BSTR str;
int j;
};
typedef
[
uuid(633CCB72-AFD2-4904-98D4-5788AE81147B),
helpstring("tstruct_t structure")
]
struct tstruct_t datat;
HRESULT testfunc1([in,out] VARIANT *ptests);
在com中定义如下:
在调试时发现在com中返回的是安全数组,可以取可以取到vb.net端传过来的字符数据,但是在vb端调用时会出现以下错误:
"The specified record cannot be mapped to a managed value class."
参考以下链接:http://support.microsoft.com/default.aspx?scid=kb;en-us;309329
解决方案是说:"To resolve this problem, construct a custom marshaler that adds this functionality. "
不知怎么解决?