Windows Media Player for Pocket PC (and Smartphone) doesn’t have a true object model like it’s desktop cousin, so the ability to use it from your own code is limited. However there is an undocumented method of sending commands to Windows Media Player via a specific series of Windows Messages. These are actually hidden away in the Registry under the curiously named section “Pendant Bus”.
Therefore I put together a simple dll which creates an instance of Media Player if one is not already running, and sends messages to it, to allow you to play, pause, move back and forward through the playlist or adjust the volume. The code requires the Smart Device Framework which is used to P/Invoke a couple of Windows methods e.g. SendMessage. A typical method looks like:-
/// Skips to the next track in the playlist.
public void NextTrack()
Win32Window.SendMessage(hwnd, 32972, IntPtr.Zero, 0);
There are some limitations in the code I’ve posted here – it doesn’t start the player with a specific file queued up (this would require a very simple overload to the constructor).
There are currently no events and it is not possible to get information back from the player such as track name, elapsed time etc. I’m still investigating whether such information is output in any way which can be captured. This code should work with all Windows Mobile 2003 devices (inc Smartphone) and possibly earlier Pocket PCs but these have not been tested yet.