Still, I don't have a solution to this interop-problem.
But this is what I found out:
The "Class not registered"-Exception appears only with Version 9 of Windows Media Player. The example from Alex Feinman makes use of the desktop-Version (Win32) of WMP10-DLL, which is compatible with the Pocket Version (CE/Mobile) of WMP10, but unfortunately is not compatible to Pocket WMP 9.
I have tried to use the wmppia.dll from WMP9 SDK and also the WMPCEOCX.dll from my Windows Mobile Device in the same way as in the example, but aximp doesn't work with these.
I also tried to P/Invoke functions from that dll, but without success.
You should try to run your application on a device with WMP 10 installed, if possible. This should work.
Another approach that I am currently trying is to manually write a AxWmpLib, fitting to the interface of the "Microsoft Windows Media Player 8.x for Pocket PC".
In the first step, I create a type library from the "playerOCX.idl" contained in the "\Samples\MediaBookmarker"-directory of the SDK:
midl playerocx.idl
This produces "playerOCX.tlb". If some errors appear concerning a duplicate UUID, just comment these lines out.
I can use this file to create a dll that can be referenced from the .NET-project:
tlbImp playerocx.tlb
This dll contains the interface-definitions for the Media Player 8.x Control and has to be added to your Project (add reference).
Then I create a class that is inherited from AxHost. In the constructor, I call the base-constructor with the according GUID ("22D6F312-B0F6-11D0-94AB-0080C74C7E95"). After that, I can retrieve a WMP-ActiveX-Object via
this.ocx = (PLAYEROCXLib.IWMP) base.GetOcx();
I added a method/proprty URL to this class to set the name of the file that is to be played:
public virtual string URL
{
get
{
if ((this.ocx == null))
{
throw new System.Windows.Forms.AxHost.InvalidActiveXStateException("URL", System.Windows.Forms.AxHost.ActiveXInvokeKind.PropertyGet);
}
return this.ocx.FileName;
}
set
{
if ((this.ocx == null))
{
throw new System.Windows.Forms.AxHost.InvalidActiveXStateException("URL", System.Windows.Forms.AxHost.ActiveXInvokeKind.PropertySet);
}
this.ocx.FileName = value;
}
}
I managed to compile this class to a dll, that can be added to the toolbar, just like in Feinmans example.
I get this activeX-control running, playing a mp3-file, but video doesn't work yet. Don't know the reason at the moment, but for some strange reason, the display doesn't refresh properly.
The same effect appears when embedding the control in an HTML-page in Pocket IE. (compatibility perhaps?)