I’m finishing up my little Signature Enhancement Utility for Outlook and had finally gotten the Media Center 12 “Currently listening to” functions operational (This is just a minor feature I’ve seen popular on website blogs and forums, where the tag line contains not only the author’s name but what they are currently listening to, if anything, nifty and fun, but not in the least practical).
I figured I’d go ahead and try to support Windows Media Player 11 (and hopefully earlier versions) as well.
Basically, the idea is to grab a reference to the running instance, interrogate it as to the “playing” state and, if it’s playing or paused, retrieve the name, album, artist, etc info on the playing track and make it available as replaceable fields in the signature.
With Media Center, it was almost trivial:
Set omc = GetObject(, "MediaJukebox Application") If not omc is nothing Then '---- it's running ' if it's not running, they can't be playing any music With omc Select Case .GetPlayback.State Case PLAYSTATE_PAUSED, PLAYSTATE_PLAYING '---- Media center info is available ps = .GetCurPlaylist.Position CurTrackTitle$ = .GetCurPlaylist.GetFile(ps).Name etc...
Obviously, if the GETOBJECT fails to return anything, Media Center isn’t currently running so the user can’t be listening to anything.
Three hours of Googling later, plus tons of experimentation and I’m not even an inch closer to getting this working for Media Player.
Using ROTView(the Running Object Table viewer, comes with various installations of Visual Studio), it does appear that WMP registers “something” with the ROT, which I’d think would be accessible by VB’s GetObject().
Alas, “Windows Media Player”, “WindowsMediaPlayer”, “MediaPlayer.MediaPlayer”, and on and on, all came up empty.
I scoured the registry for anything that even remotely looked like the moniker of a WMP registration with the ROT and everything I tried also came up empty. I’m sure it’s another case of knowing the magic password, but so far, it appears to be a tad more involved than Speak, friend, and enter.
So, for now, looks like I’ll have to rely on the FunPack for support of a limited set of attributes of the currently playing song in WMP. Apparently, for ITunes, you can use this plugin to accomplish the same thing, though I don’t use ITunes and probably won’t bother with testing that.
If anyone’s ever had any success with accessing the running instance of Media Player, I’d love to hear about it!