![](/img/trans.png)
[英]How to read a C++ SAFEARRAY** that is a Result from a COM interop where the C# return value was byte[]?
[英]Return byte array from C# to VBScript via COM interop
我有一個返回一個字節數組我希望能夠從VBScript訪問C#方法。 或多或少:
namespace ClassLibrary7
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid("63A77D29-DB8C-4733-91B6-3CC9C2D1340E")]
[ComVisible(true)]
public class Class1
{
public void Create(
out byte[] BinaryData
)
{
// do some work and return BinaryData
BinaryData = new byte[] { 1, 2, 3, 4 };
}
}
}
和vbscript看起來像:
dim o
dim b
set o = wscript.CreateObject("ClassLibrary7.Class1")
o.Create b
MsgBox ubound(b)
我迷路了。 Google不想合作...我希望這里的人能為您提供幫助!
搶
這應該有助於:
COM Interop第2部分:C#服務器教程
http://msdn.microsoft.com/zh-CN/library/aa645738(VS.71).aspx
和這個:
使用.NET創建COM服務器。 C#
http://codebetter.com/blogs/peter.van.ooijen/archive/2005/08/02/130157.aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.