com

CComModule::Unlock();

I've been trying to determine what this function does, however I cannot seem to find it anywhere under the MSDN documentation of the CComModule class. Could anyone tell me what it is used for? ...

Use of COM object in IIS 7

Hi all, I am currently moving an ASP.NET web-project from an IIS 6 to a IIS 7 hosting environment. Everything seems to be running OK, except my calls to a COM object. I can perfectly instantiate an object of the COM type, but when I call one of its methods, the IIS crashes. The event log reports an error code "0xc0000374", which indica...

C++ DLLs newer version

All, I have a C++ COM DLL written using Visual Studio. All the interfaces have GUIDs in idl and rgs files. We want to create a new DLL with brand new GUIDs as we want it to co-exist on the same machine with the old one but with different logic. The number of GUIDs is more than 200. Is there a tool that finds the GUIDs and replaces them...

Registering a COM control during installation

One of our applications needs to register a COM control during installation. If a newer version of that control is already registered, we don't want to overwrite it with the older. What are the Windows MSI install conditions I would user to control this? Or is there some other 'best-practice' method I'm not aware of? Thanks ...

IWebBrowser2: how to force links to open in new window?

The MSDN documentation on WebBrowser Customization explains how to prevent new windows from being opened and how to cancel navigation. In my case, my application is hosting an IWebBrowser2 but I don't want the user to navigate to new pages within my app. Instead, I'd like to open all links in a new IE window. The desired behavior is: use...

Calling a native callback from managed .NET code (when loading the managed code using COM)

Hi, I am really confused by the multitude of misinformation about native / managed interop. I have a regular C++ exe which is NOT built using CLR stuff (it is neither Managed C++ nor C++/CLI and never will be). This C++ exe is "in charge", there is no managed wrapper for it. I would like to access some code I have in a C# assembly fro...

Does *every* Excel interop object need to be released using Marshal.ReleaseComObject?

I've seen several examples where Marshal.ReleaseComObject() is used with Excel Interop objects (i.e., objects from namespace Microsoft.Office.Interop.Excel), but I've seen it used to various degrees. I'm wondering if I can get away with something like this: var application = new ApplicationClass(); try { // do work with application...

Which book should I study to learn COM?

I have access to Inside COM (By Dale Rogerson) and Essential COM (By Don Box). Which one should I start with to learn COM? ...

Regasm writes mscoree.dll into Registry key InprocServer32

When I register my .NET Assembly with regasm.exe the registry key HKEY_CLASSES_ROOT\CLSID{111E32AD-4BF8-495F-AB4D-6C61BD463EA4}\InprocServer32 is set to "mscoree.dll". However, I am trying to mimic an existing COM-Server that was written in C. When registering this old COM-server the InprocServer32 is set to the full path to this com...

Out of Process COM Server - function calls and threads

When you have an out of process COM Server and you call a function from a Client inside this server from Thread X inside the client, then how this function get executed in the COM Server? In the thread its currently executing on, or on its main thread? ...

How to extract a GUID from a Win32 DLL or OCX

We have a .NET app that needs to examine a folder that may contain COM libraries (DLL and OCX.) When we do encounter a COM library one thing we need to accomplish is to extract the GUID from the COM DLL or OCX. Is there a straightforward way to do this with .NET without using 3rd party libraries? ...

.Net to COM Interop Tester

I made a class in C# that I am exposing to COM. I can register it just fine using RegAsm.exe. I would like to test it before I send it off, but using TlbImp.exe gives me an error of "Type libaray was exported from a CLR assembly and cannot be re-imported as a CLR assemply." What is a good way to test this? ...

CoGetClassObject gives many First-chance exceptions in ATL project. Should I worry?

Hello, I have written a COM object that in turn uses a thrid party ActiveX control. In my FinalConstruct() for my COM object, I instantiate the ActiveX control with the follow code: HRESULT hRes; LPCLASSFACTORY2 pClassFactory; hRes = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED); bool bTest = SUCCEEDED(hRes); if (!bTest) r...

Working with .tlb files

Hello, I've created a c# com interop dll project that generates both .dll and .tlb files. When I use them on the computer that I built everythig, all works fine. But when I pass it to another computer (with the same windows installed), it doesn't work. I allready made the: Regasm.exe SoundLogDLL.dll /tlb:SoundLogDLL.tlb command, but s...

Setting System.Drawing.Color through .NET COM Interop

I am trying to use Aspose.Words library through COM Interop. There is one critical problem: I cannot set color. It is supposed to work by assigning to DocumentBuilder.Font.Color, but when I try to do it I get OLE error 0x80131509. My problem is pretty much like this one. update: Code Sample: from win32com.client import Dispatch Doc = ...

How to create a "Shell IDList Array" to support drag-and-drop of virtual files from C# to Windows Explorer?

I started trying to implement drag-and-drop of virtual files (from a C# 4/WPF app) with this codeproject tutorial. After spending some time trying to figure out a DV_E_FORMATETC error, I figured out I need to support the "Shell IDList Array" data format. But there seems to be next to zero documentation on what this format actually does. ...

COM(C++) Programming Tutorials

Hey guys, I was wondering if there're any good sites that deal with learning C++/COM from the ground up? Looking for something like a crash course (two weeks, and not being hypothetical here). Assume knowledge in standard C/C++, or at least not a complete dummy. ...

.net component installer for COM interop

I have a .net component that will be called by unmanaged code. I want to create an installer for the .net component that will in one step.. -install it to the desired directory -generate the tlb file -run the regasm command The deployers of this component dont have knowledge of the .net framework. Any ideas? Thanks. ...

Enumerating and using wmp visualizers

Hi! I want to use the systems available windows media player visualizers in my app. Apperently visualizers expose an IWMPEffects interface to the world. My question is how do I enumerate and create instances to the available visualizers on my system? Probably it's just a process of getting the cslid of the visualizers and then create th...

Finalizing a COM object

I'm trying to implement a singleton class, that holds a com object inside it. Class implements IDisposable interface, but when I try to implement a finalization method, I get an exception of access to com object from another thread. This happens because clr uses a different thread when finalizes objects. Is there any way to implem...