com-interop

How to get a .NET CCW assembly to load configuration from a dll.config

I have a .NET component exposed as a CCW (Com Callable Wrapper) and being loaded into an unmanaged IIS application (ATL server). The assembly is installed and registered with COM using regasm /codebase. The component requires configuration such as is typically put into a Web.config file for an IIS app. But I don't want to drop the con...

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

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...

Registering assembly for COM interop from nant

Hi, I'm running msbuild from a nant script, the problem is that when it tries to register one of my assemblies for com interop, the script just stops, like it's stuck. If I run regasm.exe on the assembly it succeeds. Even if I run msbuild itself from the command-line, with the exact same parameters, it builds successfully. Any ideas o...

What are your success or horror stories with Lucene.Net and MS's COM Filter?

I am interested in building a search solution with Lucene.Net for pdf and MS Office documents. My idea is to have a Windows service that runs and indexes files on a scheduled basis. From my cursory reading I have to use a COM filter from Microsoft that perform indexing on the .docs, .ppts, etc. What issues did you encounter and how ...

Getting Vista/Windows Search/propsys.dll properties from the shell in managed code

Has anyone managed to do this? I tried making a managed wrapper class for IPropertyStore but am getting AccessViolationExceptions on the methods (i.e. IPropertyStore::GetValue) that take a pointer to PROPVARIANT (rendered as a MarshalAs(UnmanagedType.Struct) out parameter in my managed version) Probably my understanding of COM and inte...

Unable to add reference from COM

I am unable to select Microsoft.Office.Interop.Excel from my window/assembly directory. I can see that one is there but it does not give me the option to reference it. How can i select it? ...

Entlib and interop: does it work, and where does the config file go?

I'm trying to use the EntLib 3.1 within .net code for a dll which is registered for COM interop. Where do I put the config file? Alternatively, is there a way to specify within the dll code where it should get the entlib config from? Since my dll will be called from COM I don't always know what exe will be calling it. I created a simp...

Is it possible to test a COM-exposed assembly from .NET?

I have a .NET assembly which I have exposed to COM via a tlb file, and an installer which registers the tlb. I have manually checked that the installer works correctly and that COM clients can access the library. So far, so good... However, I am trying to put together some automated system tests which check that the installer is working...

Can't instantiate a COM object written in C# from VBA (VB6 ok)

Using VS 2008, here is my COM object using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; namespace TestCom { [Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("Test9.COMINT")] public cl...

.NET Interop: Find All instances of of a running COM object with C#

Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progi...

.NET / COM events interoperability

I have an interop assembly generated by TlbImp.exe, the generated classes are heavily evented and the performance is very important. But there's a problem, the events seem to be registered/unregistered/invoked in such a manner that even empty event handlers are counted in. Given a set of 1..N events, when you register a handler to an ev...

Tool to import Type Libraries as C# code

Is there a tool to import/convert COM type libraries into C# code rather than generating an assembly? The TLBIMP tool and the TypeLibaryConverter class only generate assemblies. I've had some success ripping the C# ComImport definitions by running Reflector over the generated Interop assembly and copying a pasting the disassembled sourc...

Using a C# class library as a COM+ server application

I created a .NET class library in C# and exposed it to COM. It works fine as an in-proc COM server. However I want to use it as an out-proc COM server to have it in a separate process. To do so I try to create a COM+ application. I created an empty COM+ application and added the classes implemented in the class library into it. When I c...

Excel reference to .NET DLL breaks with new version

I have a .NET DLL which is installed to the GAC, as it is used by several applications. One of these is an Excel workbook which references the DLL using .NET's COM interop facility. The COM tlb file is installed to an application directory. This all works fine except when an updated version of the DLL is installed. On some PCs the CO...

How to Manage COM Objects in .Net Web Application

A legacy c++ applications with sometimes notorious memory leak issues has to be called from a .Net server based windows application. .Net garbage collection times are not determinable and sometime the c++ object are destroyed or not destroyed "on time" producing unpredictable results and generally crashing the c# web app. What is the b...

Implementing IProvideClassInfo on C# COM Object

I'm trying to implement the IProvideClassInfo on a C# COM object so it's events can be used from Windows Script Host (WSH). I've managed to implement the interface and trace a call in to my GetClassInfo method. However, hooking up the events fails with "Cannot connect object". Has anyone managed to do this? This is my script code (JSc...

Default Property for dotNet Interop Usercontrol

I need to set the default property of a dotNet Control used by an VB6 Application. <ComClass(myControl.ClassId, myControl.InterfaceId, myControl.EventsId)> _ <DefaultProperty("NewProperty")> _ Public Class myControl Public Const ClassId As String = "86252de2-ca87-4468-adbe-ad7c47747759" Public Const InterfaceId As String = "c1c...

Excel Interop: Range.FormatConditions.Add throws MissingMethodException

I am writing an application which uses the Microsoft.Office.Interop.Excel assembly to export/import data from Excel spreadsheets. Everything was going fine (except for 1 based indexing and all those optional parameters!), until I tried to use conditional formatting. When I call Range.FormatConditions.Add I get a MissingMethodException ...

How to return a JavaScript 'native' array from a C# method?

I'm trying to call a C# method from JavaScript by using ActiveXObject: var myobj = new ActiveXObject('myobject'); var arr = myobj.GetArray(); Eventually, arr will contain a SAFEARRAY object, but not JScript array. Is there any way to return native JavaScript object from a C# method? ...

Save and Run JScript function into ActiveXObject field

Hi, I'm using ActiveXObject writted on C# and hosted in Internet Explorer: <object id="exControl" classid="http://localhost:81/excontrol/ExpandoControl.dll#ExpandoControl.ExpandoControl"&gt; </object> My exControl has NormalField property of object type (but I've tried to use JScript.FunctionObject class as well). So I'm trying to r...