com

Retrieving the original error number from a COM method called via reflection

I have a VB6 COM component which I need to call from my .Net method. I use reflection to create an instance of the COM object and activate it in the following manner: f_oType = Type.GetTypeFromProgID(MyProgId); f_oInstance = Activator.CreateInstance(f_oType); I need to use GetTypeFromProgID rather than using tlbimp to create a library...

Selecting Office 2003/2007 COM Object (Correct One) in Winforms Application

We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM object at runtime? ...

Runtime callable wrapper (RCW) scope - process or application domain?

What is the scope of Runtime Callable Wrapper (RCW), when referencing unmanaged COM objects? According to the docs: The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object. If I had to "guess" - this explanation should mean "one per process", but is it really? ...

Using Generic lists on serviced component

Hello, I'm trying to use a generic List as a property on a ServicedComponent class... public class MyCOM : ServicedComponent { public enum MyEnumType { Value1, Value2, Value3 } public List<MyEnumType> MyList { private set; get; } public MyCOM() { MyList = new List<MyEnumType>(); } } The code co...

What does stdole.dll do?

We have a large C# (.net 2.0) app which uses our own C++ COM component and a 3rd party fingerprint scanner library also accessed via COM. We ran into an issue where in production some events from the fingerprint library do not get fired into the C# app, although events from our own C++ COM component fired and were received just fine. Us...

How to open existing file using COM/ATL (no MFC)

I have an existing Windows C++ application that links to ATL. I need to open an existing Excel file and access some properties. One of the things I need to do is determine if the user is currently viewing the Excel file. We can assume that the user has Excel installed, although not sure which version. What is the C++ / COM code to at...

COM Registration and the GAC

I have a web project, a C# library project, and a web setup project in Visual Studio 2005. The web project needs the C# library needs to be registered in the GAC. This is simple, just add the GAC folder to the setup project and drop the primary output of the C# library in there. The C# library also needs to be registered for COM interop....

ActiveX events between apartments

Environment: VS2008 (ATL), Borland Developer Studio 2006. Hello all. I'm having some troubles with ActiveX control events. Here is a brief description of my app architecture: There is an inproc COM server which contains STA ActiveX control (aka control) and MTA COM object (aka object). Here is the IDL definition of the control an...

What are the differences between using the New keyword and calling CreateObject in Excel VBA?

What criteria should I use to decide whether I write VBA code like this: Set xmlDocument = New MSXML2.DOMDocument or like this: Set xmlDocument = CreateObject("MSXML2.DOMDocument") ? ...

Should there be a difference between an empty BSTR and a NULL BSTR?

When maintaining a COM interface should an empty BSTR be treated the same way as NULL? In other words should these two function calls produce the same result? // Empty BSTR CComBSTR empty(L""); // Or SysAllocString(L"") someObj->Foo(empty); // NULL BSTR someObj->Foo(NULL); ...

Calling .NET COM web service wrapper from Excel

I'm trying to call a web service from Excel 2003 module. The way i've implemented it is creating a .NET COM library with all the classes/methods i need to be exposed. When i try to call a method that queries a web service from Excel the execution just stops on that line without any error. May be it has to do with references? I'm using Mi...

Implementation of ISupportErrorInfo - what does it mean?

What does the ISupportErrorInfo interface mean? I'm at a bit of a loss to understand it. From MSDN: This interface ensures that error information can be propagated up the call chain correctly. Automation objects that use the error handling interfaces must implement ISupportErrorInfo. This method indicates whether or no...

Using .NET's UserControl as an embedded control via COM

Hi, I'm porting an existing .NET 3.5 application into a plug-in for Eclipse. I want to have my custom UserControl, written in C#, embedded within Eclipse; I've exported it successfully as a COM Control, and it works well in Eclipse Europa. In Ganymede, it seems the OLE load code has changed, and what originally worked in Europa, fai...

Displaying path/version information for a loaded COM object?

I've got some code that uses the Component Categories manager to load all of the classes that implement a particular category. Is there an easy way to get a description, path and version information from the loaded DLL or EXE? ...

Only creating a COM object if the DLL that implements it is signed?

We've got some code that uses LoadLibrary and GetProcAddress to implement a plugin architecture for one of our products. We ensure that the DLL about to be loaded is signed with our code-signing key. We're changing the plugin architecture to use COM instead. Is there a way to enforce code-signing (preferably with our certificate) when i...

Buildprocess for ActiveX / COM / VB6 enterprise projects

We have developed a software system using ActiveX/COM (VB6) technology from microsoft. In the last year, i get more and more interested in automated build processes and SCM at a whole. I intensively searched big parts of the web for information about best practices how to do scm with COM based software systems. The "problem" with COM is...

Excel SheetSelectionChange event example needed. C++

I have a problem I'm trying to solve involving interfaceing a C++ program with Excel (an import interface, specifically). The SheetSelectionChange sounds like it will get me most of the way to where I need to be, but I can't find any good documentation or examples on registering the event, using its Range parameter when it's fired, and ...

What's the best/easiest way to manipulate ActiveX objects in Java?

I want to open and manipulate Excel files with ActiveX. I've had success with Python's Win32 Extensions and Groovy's Scriptom libraries on other projects but need to do this is pure Java this time if possible. I've tried the Jacob Java COM Bridge but that doesn't seem as straightforward or simple to use, and I couldn't get it to retr...

Help refactor function that takes lots of arguments.

Hi all, I was wondering if anyone would be able to help me refactor some code that I wrote a while ago. I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call. I was just wondering if anyone could think of a better w...

ASP.NET session and storing objects that use COM interop

I'm working on an asp.net web site. We have to use com interop to interact with legacy vb6 activex components. The components in many cases rely on receiving a context object (which is itself a vb6 activex component) as a parameter. The context object is fairly costly to construct. Therefore one idea is that a context object is const...