com-interop

unable to select correct ADODB version COM API

quick question is the public key token for ADODB dll different for 64bit and 32bit. I am trying to use a COM api which uses ADODB.Recordset and some how I am not able select the right version of ADODB in VS(2010) it asks for 2.8.0.0 and I add 2.8 from the reference dialog. The only thing I can think of is that I am using a 64bit win7 ...

vb.net A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

I just installed Visual Basic 2010 Express. I created a simple console application: Module Module1 Sub Main() Dim i As Integer i = 0 End Sub End Module I'm getting the following error SIX times before I get to line "i = 0": A first chance exception of type 'System.Runtime.InteropServices.COMException' occur...

How can I reliably check client identity whilst making DCOM calls to a C# .NET 3.5 Server?

I have an old Win32 C++ DCOM Server that I am rewriting to use C# .NET 3.5. The client applications sit on remote Windows XP machines and are also written in C++. These clients must remain unchanged, hence I must implement the interfaces on new .NET objects. This has been done, and is working successfully regarding the implementation of...

MFC Dll with COM Interface

Hi All, I am pretty new to managed/unmanaged interoperability and COM concepts. I received a suggestion of using COM Interop, for using my existing MFC code in C#. But the problem for me is, i have a MFC Dll which is not a valid COM component. How to make this MFC DLLs to have COM-accessible interfaces ready for use in .NET. I tried t...

Deadlock problem

Hello i'm having a deadlock problem with the following code. It happens when i call the function getMap(). But i can't reealy see what can cause this. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.Drawing.Imaging; using System.Threading; using AForge; using AFor...

Lifetime issue of IDisposable unmanaged resources in a complex object graph?

This question is about dealing with unmanaged resources (COM interop) and making sure there won't be any resource leaks. I'd appreciate feedback on whether I seem to do things the right way. Background: Let's say I've got two classes: A class LimitedComResource which is a wrapper around a COM object (received via some API). There ...

Using Wrapper objects to Properly clean up excel interop objects

All of these questions: Excel 2007 Hangs When Closing via .NET How to properly clean up Excel interop objects in C# How to properly clean up interop objects in C# struggle with the problem that C# does not release the Excel COM objects properly after using them. There are mainly two directions of working around this issue: Kill the...

Do the new NoPIA and Type Equivalence features in C#/.NET 4.0 mean Microsoft.mshtml.dll is no longer needed

I'm maintaining a WPF based application which contains a WinForms based WebBrowser control that based on the IE web browser control. When we deploy, we have had to also supply Microsoft.mshtml.dll and do some custom configuration stuff for our ClickOnce publishing process as well in order to get things to work. I'm curious that with the...

import txt files using excel interop in C# (QueryTables.Add)

Hi all, I am trying to insert text files into excel cell using Querytables.Add; no error, but the worksheet is empty. except for the single cell manipulation using Value2 property. I already using macro to record the object used. Can you help me on this(I am using vs2008, C# , excel 2003 and 2007; both shown empty cell). Below is my ...

Problems with native Win32api RichEdit control and its IRichEditOle interface

Hi All! As part of writing custom command (COM-Visible dll with class that implements Interwoven command interface) for one of Interwoven Worksite dialog boxes,I need to extract information from RichEdit textbox. The only connection to the existing dialog box is its HWND handle; Seemingly trivial task , but I got stuck : Using standa...

Is there any reason against directly calling AddRef() inside QueryInterface() implementation?

When implementing IUnknown::QueryInterface() in C++ there're several caveats with pointers manipulation. For example, when the class implements several interfaces (multiple inheritance) explicit upcasts are necessary: class CMyClass : public IInterface1, public IInterface2 { }; //inside CMyClass::QueryInterface(): if( iid == __uuidof...

.Net Com Interop Create Instance Slow

I have a .net 4 application that uses a Com Dll to send SMS messages. I used TlbImp to create the interop assembly and that is what is referenced in the application. When I try to create an instance of this class, it takes a really long time (2-5 seconds). I ran performance profile in VS 2010 and the call that takes the longest by far...

Cast exception when trying to create new Task Schedueler task.

I'm attempting to create a new task in the Windows Task Scheduler in C#. What I've got so far is pretty much a copy and paste of http://bartdesmet.net/blogs/bart/archive/2008/02/23/calling-the-task-scheduler-in-windows-vista-and-windows-server-2008-from-managed-code.aspx Everything compiles just fine but come run time I get the followin...

Events not sent to WPF based ActiveX control (COM interop) when using Reg-Free-COM

I have a WPF based ActiveX control (COM interop). I am able to use it correctly by registering the control. When I tried to Reg-Free-COM (using manifest files) the control seems to be activated, but the events (such as mouse click, RequestBringIntoView etc) dont respond. Interestingly, Double click and tab key works. I read in the this ...

How to Use .NET Assembly from Legacy SQL Server 2000 DTS

Hi All, I have a .NET assembly that needs to be called from a DTS package. There are two options I am considering to get this to work: 1) write a COM-callable wrapper for the .NET assembly and have the VBScript create the COM object to use 2) write a .NET command-line exe that uses that .NET assembly and have the VBScript execute tha...

Any way to avoid creating a huge C# COM interface wrapper when only a few methods needed?

Greetings all, I’m working on a C# program that requires being able to get the index of the hot item in Windows 7 Explorer’s new ItemsView control. Fortunately, Microsoft has provided a way to do this through UI Automation, by querying custom properties of the control. Unfortunately, the System.Windows.Automation namespace inexplicabl...

Installing a shared assembly to the GAC with COM interop

Specifically, I am using Wise Installation Studio to install several shared .NET 2.0 assemblies into the GAC. These are being used by some legacy COM application files as well as other application assemblies. I have the flag for "Generate COM interop registry keys for .NET assembly" set. Reference counting appears to be working for re...

Is it possible that COM interop is affected by the Visual Studio Hosting Process?

I am having problems running a 32-bit .NET application on Windows 7 x64 that seems to center around a 3rd party COM library. Here's the setup: Our application was written for 32-bit Windows XP, but we tried to set things up so that it would run properly on 64-bit Windows. It relies on P/Invoke and COM Interop with several 32-bit 3rd p...

How Does a COM Program Locate a .NET DLL Registered for COM Interop?

One customer wants to consume our .NET DLLs from VB6. They are designed to support reverse interop and all works fine... except: There are two separate VB6 programs in two different directories. It seems it's necessary to do one of: Copy the .NET DLL into both directories, or Install the .NET DLL in the GAC This is the customer's o...

Getting ReportAvOnComRelease Exception when using 3rd party COM

I am a new C# programmer and have created an application which uses a 3rd party COM object to track telephone call recordings from a call recording server. The creator of the COM software is also the vendor who makes the call recording software, so you would think it should work. I have been on many phone calls and code reviews with thei...