Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 返回导致SafeArrayTypeMismatchException的SAFEARRAY(长)的COM对象_Vb.net_Com_Safearray - Fatal编程技术网

Vb.net 返回导致SafeArrayTypeMismatchException的SAFEARRAY(长)的COM对象

Vb.net 返回导致SafeArrayTypeMismatchException的SAFEARRAY(长)的COM对象,vb.net,com,safearray,Vb.net,Com,Safearray,我使用API类型库为我们在工作中使用的程序编写插件。它是一个名为SCAPI的COM对象。COM对象是为VB6编写的,因此当我为.NET添加对它的引用时,会创建一个互操作版本 当我使用下面的代码时,根据文档,它应该返回一个SAFEARRAY(Long),我得到一个错误,说我有一个SafeArrayTypeMismatchException Dim oBag As SCAPI.PropertyBag = tempModel.PropertyBag Dim x = oBag.Value("Crea

我使用API类型库为我们在工作中使用的程序编写插件。它是一个名为SCAPI的COM对象。COM对象是为VB6编写的,因此当我为.NET添加对它的引用时,会创建一个互操作版本

当我使用下面的代码时,根据文档,它应该返回一个SAFEARRAY(Long),我得到一个错误,说我有一个SafeArrayTypeMismatchException

 Dim oBag As SCAPI.PropertyBag = tempModel.PropertyBag
 Dim x = oBag.Value("Created")
错误是从SCAPI.PropertyBagClass.get_Value(Object Property)函数抛出的,它是COM对象的一部分,不是我写的东西。在我做了所有的研究之后,我似乎不知道我需要做些什么才能让它工作。我使用了tlbimp.exe来获取方法信息,但它似乎不包含任何[out]标记,即使我使用了相同的函数oBag.Value(“Name”),该函数返回字符串值并且不会引发错误:

 .method public hidebysig newslot specialname abstract virtual 
         instance object 
         marshal( struct) 
         get_Value([in] object  marshal( struct) Property) runtime managed internalcall
 {
 .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 01 00 02 60 00 00 )                         // .....`..
 } // end of method ISCPropertyBag::get_Value

您的数组条目是否足够大,需要长数据类型?尝试使用Integer,看看它是否有效。我有一个类似的问题,VB不能识别长的数据类型。