com-interop

Loading a 32-bit or 64-bit side-by-side COM DLL depending on the bitness with which the application runs

Hi, I have a .NET application that uses a COM DLL, of which there is both a 32bit and a 64bit version. I have written two application manifests that make side-by-side COM interop work on either 32 Bit or 64 Bit. Here the 32-bit version: <?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-c...

Managed + unmanaged application causes memory leak

I have a wrapper managed application(.net) over a COM Component(created using vb6) where Com component also uses native c++ dll. Aplication runs as a background process and is supposed to run continously 24 X 7. The application runs fine for certain time, but after certain time it crashes. Possible reasons might be momory leak in c++ d...

Compiling Quantlib via SWIG for C#

Anyone have any experience using SWIG ? I am currently researching QuantLib and saw that C# code can be generated using SWIG. We are exploring options to create a combined library of financial functions using QuantLib and a proprietary closed source library (which will probably be made available as .Net dlls). The idea is to combine bot...

How do I convert System__ComObject to an image?

I'm using DSOFile to get the summary properties from some Crystal Reports report files. SummaryProperties.Thumbnail returns an object and I need to convert the object to an image so I can display it as a preview on my form. I have tried casting it to a System.Drawing.Image but I get an error "ImageConverter cannot convert from System.__C...

Trying to create a X509Certificate2 certificate fails when called within a COM interop environmen

I've got a classlibrary which defines a couple of helper classes/methods which are used from a classic asp web application. So far, everything works fine. Now I've added a new helper method which signs a PDF file using a third party tool. Using a console application to call this wrapper method, everything works fine. Once I use an asp pa...

Building an COM-interop enabled project without registering it during build

Hi, In Visual Studio 2010, I'm trying to build an COM-interop enabled C# project without registering it during build, but I DO require the assembly's typelibrary (.tlb) file, so I can import it from another C++ project in the solution. I haven't found a way of doing this - there once upon a time was a tlbexp.exe tool, but it was depreca...

C#: Properly disposing C# objects when created via COM Interop from VB6.

Im writing a C# class library component which is going to act as a TCP server. It will listen for and receive XML via a specific port, deserialize it and then raise events containing the resulting object as an event argument. The class library itself will be consumed by a VB6 application which will receive and handle the events and asso...

Issues Using Midl to create a .tlb from .idl "expecting a type specification"

Hi all, I have been having a prolonged encounter with the beast known as COM Interop... I am currently trying to generate a .tlb from a .idl file generated by the OLE/COM Object Viewer. However when trying to run Midl.exe to compile it I get an error: .\Sim.API.IDL(236) : error MIDL2025 : syntax error : expecting a type s pecificatio...

Calling a .NET component from classic ASP - web.config not found

I have a classic ASP website (yes they still exist) that needs to call a .NET DLL registered for COM interop. A simple VBScript test indicates the component is properly installed. When the .asp page runs, it creates the component properly, but when a method is called there's an application-specific error message that leads me to believ...

Why does my .NET ActiveX control fail to register in Internet Explorer?

I am writing an ActiveX control to run in Internet Explorer. I am using C# and the System.Runtime.InteropServices namespace. When I register the control manually on my development machine using regasm, the control works and I can invoke methods on it using Javascript's new ActiveXObject(..) functionality. However, for production I wan...

C# / C++ Interop Error on Function Call

I'm working on an internal project based on the Registration Free Com-Server in Microsoft's All-In-One Microsoft's All-In-One Framework. The sample shows how to generate a registration free c# COM server for a c++/native code application. As a newbie at doing COM-Interop, using this demo seemed like a good idea. This sample shows how ...

How to make a .NET COM wrapper generic

I think this is a factory / provider type story but I'm not sure how to describe my problem. It goes like this. InstallShield has a COM Automation Interface that they change the name of it with each release. If it was VBScript I'd say set project = CreateObject("ISWiAuto15.ISWiProject) ' InstallShield 2009 set project = CreateObject(...

How to get a specific section from Microsoft Word using C#

Need help in figuring out a way to fetch a particular block of content from Microsoft Word document using the section number in C# .NET. For example if a word document which has sections as follows: Introduction Format Description 3.1 Details 3.2 Tables 3.3 Figures Analysis Now from section 3.2, I would like to get access to...

Ignore excel vba errors during read cell values from C# through COM interop.

I need to read cell values from Excel document. Some documents contain vba scripts and formulas that can contain error. So during reading document occur such errors and excel show UI dialogs with question and error information. Without any reactions on these dialogs reading cannot continue. How I can ignore these errors or close dialogs...

Merging two .IDL files or two .tlb files into one file.

Hi all, I have 2 .net dll's which I expose to COM using REGASM. In order to simplify referencing within a COM client I would like to make these into one file. I have tried converting both files to IDL and then copying the contents of the Library section of one into the other and then compiling back to .tlb with MIDL. This works fine fo...

.NET database calls slow when using COM Interop, fast via query analyser

I have an Sql query that looks up a person based on SSN and returns the PersonID (identity column). There is a index on the SSN column in the persons table. I have an old VB 6 application that uses COM/.NET interop to call this query. When it does it runs relatively slow. I set up a trace using SQL Profiler and each call has a duration ...

Office Custom CommandBar events not firing when toolbar is truncated.

Have built a toolbar for office xp, added buttons, wired up events and everything works fine. The problem is when I resize the Excel window so that the custom toolbar is truncated (and the truncated buttons appear into the double arrow dropdown), none of the buttons or drowdowns that are in the truncated dropdown fire. If I expand the ...

COM issue 800A01AD only on server

I have a .NET library that I'm trying to use via COM (hMailServer's VBScript scripts). I got it all working on my local, development box (Windows 7 x64). However, after copying the DLL to my server (Windows Server 2008 x64) I keep getting the following error when the VBScript runs: Error: 800A01AD - Description: ActiveX component...

COM security on Windows Server 2008

I have a .NET library that I'm registering for COM interop. Everything works fine on my machine (windows 7 x64) -- I register the library using regasm and VBScript can run CreateObject just fine. I unregister it and CreateObject fails. Just as you'd expect. However, when I put this exact same library on my server (Windows Server 2008...

Is it possible to specify the default value of the ClassID registry key created by regasm?

When using regasm to register an assembly for COM interop, one of things it does is create a HKEY_CLASSES_ROOT\CLSID{000…000} registry key with a default value of the ProgId of the COM class (See MSDN article Registering Assemblies with COM). Is it possible to specify the string that regasm sets as the default value of the key? I.e. Giv...