com-interop

Java SWT interop with COM - putting a float[] into a Variant?

In my Java SWT application I'm hosting an 3rd party ActiveX control. I'm using OleClientSite to do this. // Ah, this works. :-) OleAutomation comObject = new OleAutomation(...); There are 2 easy little functions I want to call from Java. Here are the COM function definitions: [id(5)] void easyFoo([in] int blah); [id(20)] void proble...

Inspecting an instance of a COM / Interop class properly in VS.Net's debugger?

Good afternoon, does anyone know if and how it's possible to see COM / Interop objects properly (in their correct type) in VisualStudio's debugger? All I get is the 'evil' System.__ComObject value (even though it correctly identifies the type)? E.g.: ...

Cross User COM Interop

I am using a third party database. A host application runs the database, and allows client applications to connect to the server app over COM. I am running Windows 2003 Server, and writing all of my code in C#. On the server, I login as UserA, and am able to launch the host application locally, and then run a client app that I have writ...

COM Interop without regasm

I'm a limited user, and I need to write an Outlook macro that exposes a C# library in Outlook 2003 and 2007. I do not have any admin privilges at all, not even at install time, so I can't run RegAsm and I can't (I assume) write a managed add-in. Is there any way to call .Net code from VBA in this scenario, or are there any other solu...

How do I dispose of a VB6 COM object i'm using via an interop assembly from IronPython?

Hello. I'm using a third party COM component by means of a .NET interop assembly in IronPython, as seen here: http://stackoverflow.com/questions/1237200/how-can-i-use-a-vb6-com-reference-in-ironpython My experience in this area has been great, I'm very impressed by the amount of stuff that works seamlessly... except one thing. The 3rd...

COM Interop (how to pass an array to the com) via classic ASP

I need to create a com object for my classic asp, since i can create a .net Assembly and have it 'Interop' with com, so i proceeded to create a .net Assembly like this:- using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Da...

IronPython COM Interop: How do I chain through my interop assembly to access types from other COM components?

Hi. I'm doing .NET interop via a wrapper assembly generated by tlbimp. Anyway, this thirs party COM object has a method that returns a referance to another 3rd party typelib - actually, DAO350. Calling the method that returns this causes IronPython to fail, presumably because it can't find a type to match it to. Any ideas as to how I c...

How to properly clean up interop objects in C#

This is a follow on question to How to properly clean up excel interop objects in c#. The gyst is that using a chaining calls together (eg. ExcelObject.Foo.Bar() ) within the Excel namespace prevents garbage collection for COM objects. Instead, one should explicitly create a reference to each COM object used, and explicitly release the...

Automatically strong naming COM Interop wrappers.

I have a C# project in VS2005 that is referencing a few COM libraries. When I build it errors like this are thrown: Referenced assembly 'assemblyName' does not have a strong name. Now, I used to reference COM assemblies in VS2003 and it would automatically sign the Interop wrappers. All I had to do was set the setting 'Wrapper Assembl...

How can I invoke a static method on a .NET object over COM interop?

Is it possible to invoke a static method on a .NET Object, via COM interop? I know I could write a wrapper class. What if I don't wanna do that? ...

log4net - logging for a dll called via COM interop

I've written a .NET DLL which is called from another application using COM interop. I'd like to use log4net, but I need to specify the location of the log file at runtime from the other application. I've always used log4net in the simplest possible way for WinForms project, but since a DLL project doesn't have an app.config, and my cal...

Is it worth checking for null pointer in QueryInterface() implementation?

IUnknown::QueryInterface() is passed a void** parameter denoting an address where to put the retrieved interface. STDMETHOD QueryInterface(/* [in] */ REFIID riid, /* [iid_is][out] */ void** ppvObject) Should the implementation of QueryInterface() check this pointer for being null (and then immediately return E_POINTER) or just write t...

When return E_POINTER and when E_INVALIDARG?

COM interfaces methods can return various HRESULT values to signal invalid argument values passed. When do I return E_POINTER and when E_INVALIDARG? As I understand if a method receives an index in an encapsulated collection and it is out of bounds that is E_INVALIDARG. If a method receives an Interface** pointer where it is meant to st...

How to get type of COM object

I am referencing a COM library in Visual Studio, so it has automatically created the corresponding Interop assembly for me. I would like to do a GetType() on these com objects, but they always return System.__ComObject. Querying them for an interface works though: bool isOfType = someComeObject is ISomeComObject; //this works But what...

Need of ClassInterfaceType.None?

Didn't quite get the following from MSDN: ClassInterfaceType.None Indicates that no class interface is generated for the class. If no interfaces are implemented explicitly, the class can only provide late-bound access through the IDispatch interface. This is the recommended setting for ClassInterfaceAttribute. Usi...

List columns in a SSIS Flat File Connection

I'm trying to produce a column 'start/length' spec document from a SSIS package that exports a DB table to a flat file. I have hit something of a brick wall in getting the Columns property from the ConnectionManager object that handles the flat file connection. I am able to get the Columns property, but I cannot do anything with it, as...

Is it possible to prohibit putting my in-proc component into COM+?

I have an ATL C++ in-proc COM component. This component is not for external use - I only need it for use in our application. Once in a while users put it into COM+ and this leads to all sorts of weird errors - "Access denied", etc which I'd like to just never hear about. The best way would be to do something that would prohibit putting ...

Failure to use AppDomain from COM interop

I've a piece of .NET code that for various reasons (reliability, deployment) must run in a separate AppDomain. I've created a proxy object deriving from MBR that delegates the calls to the real stuff so it wont load in the current AppDomain. I create the proxy via the usual CreateInstanceAndUnwrap. this.eDirectCommunication = (EDirectCo...

Sever a .NET COM Interop assembly from its hosting process

When an ActiveXObject is hosted in a Windows Desktop/Sidebar Gadget, that ActiveXObject is sort of cached and the DLL file for it is locked (meaning it cannot be moved, deleted or renamed). The problem is this; when the gadget is subsequently closed, the DLL is still locked by Windows Sidebar and it cannot be removed. This causes a sig...

How to create propput IDL method .NET interface for COM usage

I am having an issue using a .NET/ComVisible assembly in Excel/VBA. I defined several parameters as "object" in .NET so they will be translated to Variant in VBA since optional parameters in VBA need to use Variant types. The problem is when I try to use the object in Excel/VBA, I get a "Run-time error '424': Object required". I think I...