com-interop

Live time on Excel

Good morning everybody. I developed an application plug-in for Excel using VSTO. The thing is that I need to have a cell displaying the current time refreshed every 10 seconds. The =NOW() function of Excel is not refreshed automatically, even when auto-calculation is on. The best solution I could come up with was to create an RTD ser...

Load different COM files with same names (older versions) from different paths in C#

Hello, i need to build a program that load older versions of a COM DLL file and performs some operations. I've created a DLL project for each version and set the reference to the correspondent COM. After that in the main program i'm trying to load the needed assembly that load and use itself its COM. The problem is that the DLLs have Int...

How to best utilize the new Type Equivalance features to host the MapPoint Control in a WPF Application

How to best utilize the new Type Equivalance features to host the MapPoint Control in a WPF Application. This is related to my other question about what is entailed as far as maintaining interop assembleis with regard to the new NoPIA and Type Equivalance features. But now I'm interested in actually getting a working implementation to s...

Deploying COM dll as part of Silverlight application

Hi, I have a legacy delphi dll. I created a class library that imports the dll and registered it for COM interop. I have an experimental Silvelight 4 application that calls the COM object and it works. The problem is: how do I deploy the COM component (and dependent delphi dll) and register the COM object on a client machine? ...

Excel interop - how to stop number (stored as text) being "evaluated"

I was wondering if anyone had come across the following problem and had any ideas on how to resolve it: I'm exporting data from a C# application (.NET 3.5) to Excel (2003) via Interop. One of the columns stores a string value that appears to be numeric. That is to say it is a number that begins with a 0 e.g. 000123 I need the full num...

How to convert PUNICODE_STRING to bstr?

Hello I'm calling a function which is in a ComVisible managed dll from a VC++ code. In the managed dll the function parameter type is string. In the VC++ code i've the variable as PUNICODE_STRING. How can i pass it to the function? How can i convert it into BSTR? Thank you. NLV ...

Using Someone else's COM Interop DLL

Hi, I'm trying to use an API that my client has a license to. I was given a COM Interop DLL. I can write all of the code I need, but when I go to run it, I receive the following error: Retrieving the COM class factory for component with CLSID {73C527F2-C6C0-4F4B-92F7-1448EC342FC5} failed due to the following error: 80040154. Any idea...

Strange consequences of "ref" keyword in C# to COM interop

Consider an excerpt from code that can be found here: namespace WinSearchFile { public class Parser { [DllImport("query.dll", CharSet = CharSet.Unicode)] private extern static int LoadIFilter (string pwcsPath, ref IUnknown pUnkOuter, ref IFilter ppIUnk); [ComImport, Guid("00000000-0000-0000-C000-000000...

What happens if a .NET 1.1 and .NET 2.0 COM object are used in the same process?

If a process loads both a .NET 1.1 COM object and a .NET 2.0 COM object, both using an in-process server, what happens? Does anything break with this configuration? Or would it be safer to make one of the objects an out-of-process server? ...

Calling unmanaged C++ COM Objects from C#

I was reading this MSDN article which deals with creating a .NET managed wrapper around a COM object. They mention two approaches, either to auto-generate the wrapper using tlbimp, or manually to create a C# interface and dummy class. But what about in our case where we have an ODL file containing a COM Interface declaration (we don't u...

Writing a COM Interop Assembly for a .NET assembly to be consumed by a VB6 app

I'm trying to create a COM Interop assembly (myComInterop.dll) between my vb6 app and a .net assembly. I'm also trying to make it so that it can be "registration free" (see here for explanation). The freedom from registration requires that I create a MyVb6App.exe.manifest file, and also that I use a strong name to sign myComInterop.dll...

Registration Free COM Interop: The application has failed to start because its side-by-side configuration is incorrect

Background. I've got a COM Wrapper assembly called ComWrapper.dll written in C#, and Visual Basic 6 application called Project1.exe. I've added the Project1.exe.manifest file (contents of which are shown below), and I'm getting an error that says "the application has failed to start because its side-by-side configuration is incorrect. ...

What is the correct way to implement a Managed Property Handler Shell Extension?

Now that .NET CLR 4.0 supports side by side (SxS) operation it should now be possible to write shell extensions in managed code. I have attempted this and successfully coded a Property Handler that implements IPropertyStore, IInitializeWithStream and IPropertyStoreCapabilities. The handler works fine and is called as expected when...

How do I return an array/list/collection of objects from C# to VB6

I am creating a COM Visible C# object to proxy calls to a webservice for VB6 application. I have a method that returns an array of objects. public DocActionReport[] DocActionReportByDateRange(System.DateTime reportStartDate, System.DateTime reportEndDate) { object[] results = this.Invoke("DocActionReportByDateRange", new obj...

Do I need to Release inner objects of a COM Interop object?

I have a managed class that uses a COM that looks like this. Public Class MyClass Private myobj as SomeComObject Public Sub New() myobj = CreateObject("SomeComObject.Class") End Sub Public Sub DoSomething() dim innerobj as SomComObject.InnerClass innerobj = myobj.CreateInnerClass("arg1", true, ...

Two-Way Communication Between HTML in .Net WebBrowser and WinForms application

When using WebBrowser control I would like to pass an object from javascript code to C#. Solution is known - using ObjectForScripting property of WebBrowser and invoking methods from javascript code using window.external. I know how to do that, but I would like to create object with given type in javascript and pass it to C# without u...

VB6 Variant Type to .NET Type

I have some VB6 code that can't be modified easily that looks like this: Dim cCount as Long Dim rCount as Long Dim result() Set mx = CreateObject("Component.Class") Dim rtn = mx.GetList(rCount,cCount,result) The method it calls is currently a VB6 component that we've migrated to .NET with one issue. We're not sure what type the resul...

Error occurred while creating/connecting to automation server 0x80131500

Based on the number of matches on Google, this may be a candidate for the Tumbleweed award, but here goes... I have a DLL written in .Net that is exposed for reverse COM interop. There are several business objects and one object that exposes a method to call a web service via WSE3. Using VBScript, all of the objects can be instantiate...

Cannot create an instance of a COM component on a server side

Hi, I'm trying to use MS IME on a server to retrieve some Japanese info in a silverlight app. The app accesses to the server by using WCF, but when calling a CoCreateInstance to create a IFELanguage2, it gives me -2147467262. The same code I'm using on the server actually works pretty fine on a WPF app. Here is the code, // ...omit G...

ComException while adding a new Item to Outlook

I'm developing an Outlook 2007/2010 plugin in VSTO (the project is for 2007, but works also with 2010). This application works with certificates (the System.Security.Cryptography.X509Certificates.X509Certificate class), which are handling some time after initialization (in other threads); I suspect this may be the reason for the ComExcep...