Any COM interop experts out there?

I’ve been spending some time trying to get Windows Media Player to work in a remoted mode from C#. There’s a C++ example in the WMP9 SDK named WMPML that does it, but it uses some special interfaces.

To get it to work, I need to register an IWMPRemoteMediaServices object with the WMP player, but despite setting it through SetSite(), my IServiceObject implementation is never called to return the type.

Anybody with some experience on the internals of AxHost and how this stuff works?

I’m not familier with the particular interface, but I do know of one big GOTCHA when doing conversions. So far I have only found this issue in anyhting that involves IOleWindow (or anything that derives from it), but it MUST be in V-Table order to be correctly called. For the longest time I could not figure out why GetWindow was never being called and as soon as I swapped the "ContextSensitiveHelp" decleration with the "GetWindow" decleration in the interface, everything was fine. Anything like that going on here?

Its soooo messy. AxHost doesn’t really provide all the things to do what you want to do so what I ended up doing was writing a really thin C++ COM object wrapper around the remoted MP object that imlemented all the interfaces (IWMPRemoteMediaServices, hosting stuff) and simply fowarded everything to the actual host. All told its about 100 lines of C++ code that all lives in a header file 😉 AxHost to answer your question does not support such site extensibilty mechanisms ( at least I haven’t turned any up )

I also ended up having to write a C++ shim for the control to get anything to work. I’ve lost the mail now, but I was told WMP10 would be "better" about this when I complained. The WMP10 SDK should be at least beta quality by now but I haven’t looked at it yet.

Hopefully with a C# guy joining the WMP team, we’ll see vast improvements in the .NET area.

It is nice to see Eric struggling with some of the stuff those outside of Microsoft have to deal with every day. 🙂 .NET and C# sure are great, but it can be far too difficult when it comes time to use the technology in a legacy real-world application.