//
archives

.NET Interop

This category contains 7 posts

Understanding Implementations for ITypeLibExporterNotifySink Part 1.

1. Introduction. 1.1 This article is a follow up to my last blog Programmatically Register Assemblies in C#. 1.2 In that article, I mentioned that I will be writing more to explain implementations for the ITypeLibExporterNotifySink interface as used in the context of a call to TypeLibConverter.ConvertAssemblyToTypeLib(). 1.3 I will dive straight into exploring this … Continue reading

Programmatically Register Assemblies in C#.

1. Introduction. 1.1 After publishing Programmatically Register COM Dlls in C# back in 2011, I received a number of requests for advise on how to register managed assemblies as COM servers. 1.2 In this blog, I will present the reader with a sample C# program that will perform such registration. 1.3 The sample assembly COM-registration … Continue reading

Passing a Reference to a SAFEARRAY as Parameter to a Managed COM Event Handler Part 3.

1. Introduction. 1.1 This blog is the third segment of the series of articles that discusses the problems and workarounds in relation to passing a reference to a SAFEARRAY as parameter to a dispinterface-based event which is fired from an unmanaged COM server to a managed client. 1.2 In part 2, I presented a workaround … Continue reading

Passing a Reference to a SAFEARRAY as Parameter to a Managed COM Event Handler Part 1.

1. Introduction 1.1 I recently ran into an unexpected problem with the .NET CLR. 1.2 It appears that its internal internal mechanism for processing COM events inadequately handles reference SAFEARRAYs passed as event parameters. 1.3 In this blog, I will demonstrate the problem with sample codes. It is my hope that interested readers will research … Continue reading

Using the TypeLibConverter to Customize Type Library Creation from an Assembly Part 2.

1. Introduction. 1.1 This article is a follow up from part 1. 1.2 In part 1, we presented C# code for a class library named CSTestInterfaceClass.dll in which an interface “ITestInterface” and a coclass “TestClass” is defined. 1.3 ITestInterface contains a single property “MyObject” of type object. Being of type object (a reference type) means … Continue reading

Using the TypeLibConverter to Customize Type Library Creation from an Assembly Part 1.

1. Introduction. 1.1 Creation of COM type libraries from an assembly with COM-visible constructs (e.g. classes, interfaces, etc) is usually performed using REGASM.EXE or TLBEXP.EXE. 1.2 However, these tools provide standardized assembly to type library type transformations which cannot be customized. 1.3 To customize type library creation, the .NET framework provides the TypeLibConverter class. 1.4 … Continue reading

Tip for Managed Applications that use COM objects – Exposing Metadata For Your COM Objects Part 2

1. Introduction 1.1 This article is a continuation of a previous article in which I expounded on how metadata can be exposed to managed code for COM objects. 1.2 In that article, the COM object was created via ProgID through the use of the Type.GetTypeFromProgID() function followed by a call to Activator.CreateInstance(). 1.3 With a … Continue reading