You'll next need to discover the wonders of a type library. There is one built into wmp.dll. You can see it with the OleView.exe utility, File + View Type library and navigate to c:\windows\system32\wmp.dll. A type library is actually binary data but OleView will decompile it into IDL. It describes the interfaces and coclasses available in a COM server, the GUIDs are included. .NET tools can see this too, you'd either use Tlbimp.exe explicitly or in the IDE use Add Reference, COM tab. That generates a so-called interop library, an assembly that contains the type library info in a format that's friendly to the CLR. It generates .NET interface and class definitions, making the COM code directly usable from a .NET program. QueryInterface, for example, is automatically called when you cast an object to an interface. The other two IUnknown methods, AddRef and Release are automatically called by the CLR, saving you the trouble of getting that wrong. Perhaps a bit unexciting, but a great way to get it working quickly and trouble-free. Hans Passant. |