佚名通过本文主要向大家介绍了高分电影,豆瓣高分电影,全民k歌怎么唱高分,公务员面试高分视频,高分起名软件等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 高分请教如何传递一个结构体从VC COM组件-〉NET VB程序?在线等待
描述:
解决方案1:
描述:
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. "
不知怎么解决?
解决方案1:
用VC.Net写一个DLL重新封装一遍吧
参考http://msdn2.microsoft.com/library/10d75z29.aspx