Home   Notes 

.NET COM Interop

Local

External


Gotchas

Assembly cannot be loaded as COM Object

  1. In the directory with the assembly regasm TEDIALOGSLib.dll (Registers it as COM)
  2. In the directory with the assembly gacutil /i TEDIALOGSLib.dll (Puts it in the global assembly cache)

.idl Custom build step

I don't know why, but this custom build step was found for an .idl file. Perhaps to let a .NET C# project get access to it.

tlbimp ../../root/usr/lib/%ARCHM%/$(InputName).tlb /out:../../root/usr/lib/%ARCHM%/Interop.$(InputName).dll

Registering Categories in C#


	[Guid("B8BFD3AD-EE40-42a2-BBA9-B85F381ACA64")]
	public class AfoTestTaskPanelImpl : 
		IAfoTestTaskPanelInterface,
		afo.IAfoCustomTaskPanel,
		afo.IAfoTaskPanel
	{
		[ComRegisterFunctionAttribute]
		public static void RegisterFunction( Type t)
		{
			// struct __declspec(uuid("{FA7AE1E7-BB7D-4e16-BDB2-EE5034EC9332}")) CATID_AfoTaskPanels;			
			Microsoft.Win32.RegistryKey hkroot = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey( "CLSID\\{" + t.GUID.ToString() + "}\\Implemented Categories\\{FA7AE1E7-BB7D-4e16-BDB2-EE5034EC9332}"); // CATID_AfoTaskPanels
		}

		[ComUnregisterFunctionAttribute]
		public static void UnregisterFunction( Type t)
		{
			Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey("CLSID\\{" + t.GUID.ToString() + "}\\Implemented Categories\\{FA7AE1E7-BB7D-4e16-BDB2-EE5034EC9332}"); // CATID_AfoTaskPanels
		}
	}