com-interop

TLB to managed .NET assembly without Regsrv32 at deploy time

喜你入骨 提交于 2019-12-20 03:08:09
问题 I have a TLB that was provided as a part of a third-party API. I used TLBIMP.exe to generate a DLL assembly wrappper. However, at development time, it appears that the assembly requires registration with regsvr32 to be used. This isn't a problem at development time however; I am using managed instances in production and registering the DLL manually will be a pain if not impossible when I deploy. Is there a way to use the managed DLL assembly in a way that doesn't require the registration step

How to cast System.Object[*] to System.Object[] II

可紊 提交于 2019-12-20 02:32:26
问题 I have got a similar problem like Cheva had in his Question: How to cast System.Object[*] to System.Object[] I use an external library (Reuters EIKON API) via the COM interop functionality. After submitting a request, the object gets updated and its data member gets updated. The Object catalogue shows this for the Data member: public virtual dynamic Data { get; } In the debug mode, I can see, that after submitting the request, DataStatus changes to dataset_full and the Data member is actually

Issue passing .NET object from VB6 to .NET

时光总嘲笑我的痴心妄想 提交于 2019-12-19 11:26:59
问题 We have a .NET dll "A" that is created by a third party. It exposes classes through a tlb to our VB6 exe application. We also have our own .NET dll "B" that references .NET dll "A". "B" also exposes classes to our VB6 exe application through a tlb. Now, the VB6 application has no problem using classes from either library in the VB6 code until we try to call a function in "B" that has a parameter type from "A". In that case, we get an error 430 or an error saying "unable to cast com object of

warning MSB3391: <DLL> does not contain any types that can be unregistered for COM Interop

你。 提交于 2019-12-19 05:22:08
问题 I've made a simple C# DLL (that's part of a much larger project) using VS2005. I need to use the DLL in Excel via VBA code so I am using COM Interop on the assembly. I am trying to make the build process automatically generate the necessary TLB file so that I don't need to go to the command line and use regasm after every build. My problem is that although the DLL compiles and builds fine, it does not generate a TLB file. Instead, the error in the title prints out in the output box. I've

Registering my .net assembly for COM interoperability doesn't expose my methods

◇◆丶佛笑我妖孽 提交于 2019-12-19 04:05:28
问题 Ok, I'm going crazy. I've been trying to make a simple .net assembly visible to use as a COM object but it's not working. I've been trying a lot of different aproaches but none of them work. So far the closest i've got is the one with the least amount of attributes, interfaces, manually registering etc. I have a vbscript as a test which looks like this: Dim o o = CreateObject("MyNamespace.MyClass") msgbox o.Test() My c# code looks like this: using System; using System.Runtime.InteropServices;

Pass an array from vba to c# using com-interop

。_饼干妹妹 提交于 2019-12-18 16:50:12
问题 What is the proper way to pass an array of user defined classes from vba to .net (specifically c#) using com-interop? Here's my c# code. If I call Method1 from vba it's failing with "Array or userdefined type expected" or "Function uses an automation type not supported in visual basic". public class MyClass { public Method1(UserDefinedClass[] Parameters) { ... } public Method2(Object Parameters) { ... } } I've read a bit about the MarshallAsAttribute class. Could this be the missing piece in

Why is the indexer on my .NET component not always accessible from VBScript?

旧巷老猫 提交于 2019-12-18 16:16:08
问题 I have a .NET assembly which I am accessing from VBScript (classic ASP) via COM interop. One class has an indexer (a.k.a. default property) which I got working from VBScript by adding the following attribute to the indexer: [DispId(0)] . It works in most cases, but not when accessing the class as a member of another object. How can I get it to work with the following syntax: Parent.Member("key") where Member has the indexer (similar to accessing the default property of the built-in Request

How does COM select how to marshal an interface?

China☆狼群 提交于 2019-12-18 12:06:19
问题 As I get it there're three ways to implement marshalling in COM: typelib marshalling proxy/stub marshalling implementing IMarshal by the object now how does the component consumer (user) choose which one will be used? Does it decide on its own and use the preferred way or does it call some built-in function and it solves the problem for it? I currently experience the following: my component implements a custom interface ICustomInterface that is also implemented by a component from another

Any sense in marking an IUnknown-derived interface as dual in IDL?

雨燕双飞 提交于 2019-12-18 06:27:09
问题 Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I remove the dual attribute? 回答1: In this answer to another question concerning marshaling user voyce points to this article that basically states the following: When any interface (IDispatch

Any sense in marking an IUnknown-derived interface as dual in IDL?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 06:25:46
问题 Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I remove the dual attribute? 回答1: In this answer to another question concerning marshaling user voyce points to this article that basically states the following: When any interface (IDispatch