//
archives

Type Information

This category contains 10 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

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

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

1. Introduction. 1.1 If you have ever used COM objects in your managed applications, you would have certainly come across an intriguing  type named “System.__ComObject”. 1.2 This type indicates a generic Runtime-Callable Wrapper (RCW) that has no metadata available. It is also an internal class in the mscorlib assembly. It is not possible to define … Continue reading

Tip for Managed Applications that use COM objects – Type Libraries are Used at Runtime.

1. Introduction. 1.1 My last article Tip for Creating a COM Server Using C# – Apartment Marshaling and the Type Library centred on the fact that for managed COM servers used by an unmanaged client app, its REGASM.EXE generated type library is not used at runtime. 1.2 As mentioned in that article, the reasons managed COM … Continue reading

Tip for Creating a COM Server Using C# – Apartment Marshaling and the Type Library.

1. Introduction. 1.1 I had earlier published Creating a COM Server Using C#. The aim of that article was to expound on the basic coding requirements for creating a COM server using the C# language. 1.2 This write-up is one of several follow-up articles that are intended to provide additional supplementary tips, techniques and knowledge … Continue reading

How to Determine if a Type Library was Generated from a .NET assembly.

1. Introduction. 1.1 When a .NET assembly (DLL or EXE) that contains a COM-visible class is compiled and registered via REGASM.EXE, a type library will be generated. 1.2 A type library may also be generated directly via TLBEXP.EXE. 1.3 The fact that this type library was generated from a managed source can be detected. 1.4 … Continue reading

How to Determine if a coclass is a Managed Class.

1. Introduction. 1.1 A managed class, when exported to COM, can be identified as being managed. 1.2 This is possible because the type library exporter, which handles the creation of the type library for the managed class library, will insert a special custom IDL attribute for the resulting coclass that represents the managed class. 1.3 This … Continue reading

Obtain Type Information of IDispatch-Based COM Objects from Managed Code.

1. Introduction. 1.1 Twice this year, someone from the MSDN forum attempted to determine the names of methods exported from a COM object by using Type.GetMethods(). 1.2 This is possible if the type library of the COM object has been imported into the managed code project using TLBIMP.EXE (see section 2 below). 1.3 When a COM object is … Continue reading