Position Changer Add-In updated for Media Center in Windows Vista


Back in early 2005, I wrote an article for MSDN on implementing add-ins for Windows XP Media Center Edition 2005.  As part of that article, I implemented an add-in that made it easy to jump around in a recorded TV show, video, or music file using the remote control, simply by entering a time code using the remote control’s number buttons.  In October of 2005, I updated the add-in for Update Rollup 2.  Now that Windows Vista is out, I’ve updated it again for Windows Vista, and the new version is now available for download.


If you have User Account Control (UAC) enabled, follow the following steps to install the add-in (if you don’t, just run the MSI):
1) Open a command prompt with “Run as administrator”
2) Run “msiexec /i pathtoaddin.msi”, where pathtoaddin.msi is, you guessed it, the path to the add-in MSI.


Note that I removed a bit of functionality for this release, specifically the bookmarking functionality, as it interferes with the new mini-guide available in Vista.


As described in the article, using the add-in is pretty straightforward.  While viewing or listening to media, press the right arrow on the remote or keyboard.  Then enter the time you want to jump to (123 for 1 minute 23 seconds, 1053 for 10 minutes 53 seconds, etc.) and press enter.  Pressing the left arrow instead of the right arrow makes the jumps relative instead of absolute.


I hope this is useful to you.


Steve

PositionChangerAddIn_Vista.zip

Comments (70)

  1. Olcay Buyan says:

    Thanks for the update.

    -Olcay

  2. andy vt says:

    In the mce 2005 version, you were able to get the file name from the graph that mce publishes.  Were you able to make that work in vista?

  3. toub says:

    That’s another reason I removed the bookmarking functionality.  In 2005, I used the hack of grabbing the published filter graph and extracting from it the path to the currently playing DVR-MS file as a way to create a key for storing bookmark information for a particular recording.  In Vista, for security reasons MCE no longer publishes the playback filter graph to the running object table, so this was no longer possible.

  4. jonnycat says:

    Thanks for the update!  Will the source for the updated version be made available? Or did I miss it somewhere?

  5. toub says:

    Definitely.  Just haven’t had the time to package it all up yet… hopefully will soon.

  6. Brad says:

    Awesome!  Thanks a lot Stephen.  This is a must have for Media Center…

  7. vern says:

    Does this version work on MCE 2005 also or do I need to keep that old MSI laying around?

  8. Dave says:

    Will this program work on extenders such as the XBOX360?

  9. toub says:

    Brad, thanks, glad you like it!

    Vern, this version is Vista specific, simply because I updated it to rely on the new add-in hosting APIs.  I didn’t have to do that, since Media Center in Vista supports add-ins written with the deprecated APIs, but when I release the code I want people to be able to compare the two versions to see the changes I made.

    Dave, this should work fine on the 360, but make sure that when you install it, you select to install it for all users rather than for just you.

  10. andy vt says:

    In RC2 (I haven’t looked in RTM), the graph was still published, but I wasn’t able to cast the filters into anything useful.  Someone over at the MCE Sandbox was able to extract useful information from them though.

  11. toub says:

    I have it on good authority that this was removed for RTM, but if you can show otherwise, I’d be interested in seeing it.

  12. andy vt says:

    I’ll take your word for it, I figured out another way to accomplish the same thing so I haven’t needed to try it in RTM.  Only downside is that it requires admin rights, but that’s easy enough to push into another process and use a mechanism like named pipes or com+ to communicate the info back.

  13. toub says:

    Cool. Out of curiosity, what is the other mechanism you discovered?

  14. andy vt says:

    "Discovered" is generous :)

    I made the assumption that each instance of ehshell can only playback one file at a time, and in order to play a file it would have to have a handle on the file.  So I used NtQuerySystemInformation to get a list of all the files ehshell has open, in my case I’m only interested in dvr-ms files so it’s pretty easy to filter.

    It’s a lot less elegant than the method you used, but it’s also much less likely to go away in the future.

  15. albain says:

    Hi Stephen,

    do you know another way to retrieve the filter graph from vista mce ?

    The managed object model does not provide an access to the graph, and now that MCE no longer publishes the graph into the ROT, I guess that we are stuck…

    Thanks

    Albain

  16. Albain says:

    There may be another way, but I am not sure about the stability : FFDShow is able to publish the graph into the ROT (there is a registry key in ffdshow settings to enable this).

    So if you are using ffdshow with this setting or if one could create a generic directshow filter that does nothing else than publishing the graph into the running object table (I don’t know if it is possible)…

  17. andy vt says:

    Even when WMC was publishing the graph (in RC2), it was doing something to the filters so they couldn’t be cast into their proper interfaces.

  18. Albain says:

    I finally found what the problem was !

    My SDK was still recent but not enough. I recovered the last version of graphedit, including

    the last version of proppage.dll and this is it : you have to register it with regsvr32, and all the missing interfaces are back : IGraphbuilder.

    Of course, it does not solve the issue with the non-publishing of the graph into the ROT by WMC…

  19. Rick Vestal says:

    Has anybody had this work on their 360?  I installed multi-user, it works on the vista box, but after hitting the right/left arrow on the remote, the 360 still wants to change channels when I type in numbers.

    Thanks,

    — Rick

  20. toub says:

    I’ll test it out again tonight on my 360 and let you know what I find.

  21. Any chance that there is a way to simply use FF and RW when playing music?  Seems like you’ve tapped into something way more powerful, but just a simple FF and RW on MP3’s in MCE would be great.

    Thanks!

  22. toub says:

    Hi Craig-

    I’m not sure I understand the question… are you asking if it’s possible to just fast-forward and rewind when playing music in MCE?  I’ve never had trouble doing so, although all of my music is in WMA format and it sounds like yours is in MP3; maybe that makes a difference?  I can try it when I get home tonight (stuck at work due to the traffic resulting from the snow here in the Seattle area).

  23. toub says:

    As with Rick, I’m also having trouble with this on my 360 using my Media Center remote.  I looked into it briefly, and the issue appears to be that the 360 is receiving different key values than is the PC, so while the add-in’s hook is in fact intercepting the values, the code in the add-in to decipher the key strokes and do something useful with them is seeing, in-effect, gibberish, and thus isn’t seeing the commands to skip around.  The questions now are: why is it getting different key values from the 360, and how can I fix it?  I’ll try to look into that soon.  In the meantime, I’ll post a new version tomorrow that includes a few minor bug fixes.

  24. Albain says:

    Hi Stephen,

    It has been a while I am working on this issue : when I register a graph into the Running Object Table and then unregister it correctly (I can see the graph appearing and then disappearing in graphedit / Connect to remote graph), the graph won’t unload after ending the media.

    When WMC registered its graph (in WMCE2005), it was correctly unloaded, so what can be the difference here ?

    I am using WMC in Vista, and the graph is registered and unregistered into the ROT through a running filter (ffdshow).

    I also tried to unregister the graph before stopping the video, but still the same.

    Thank you for your help

    Albain

  25. Albain says:

    OK I got it : the graph has to be unregistered before the graph would unload otherwise it won’t work. Besides all the access must be cleaned (filters, graph…)

  26. Haggis says:

    I have installed this on a Vist 64 RTM computer and it doesn’t seem to work. Is this a x86 only Visat MCE plugin?

  27. Haggis says:

    In addition to my comment above, when I try to uninstall it, the ininstaller pops up an empty dialog box (ie cannot read it) and a okay button. What ever I select, the uninstallation fails

  28. Albain says:

    Hi Stephen,

    I have tried to implement the same keyboard hook as you did, and it working, but only for simple keys : arrows and numbers only.

    Play/pause, fast forward key… and all the keys with "control" and/or "shift" in it are not caught. Do you know why ?

    You can visit my website to see the plugin I have made, everything is working except the remote.

    Thank you for your help

    Damien

  29. Albain says:

    Forgot the url of my website : http://damienbt.free.fr

  30. toub says:

    Play/pause/etc. are translated into Windows messages other than WM_KEYDOWN.  See my discussion of WM_APPCOMMAND in my article at http://msdn.microsoft.com/library/en-us/dnxpmce/html/positionchangeraddin.asp, as well as the mappings listed in the Using the Remote Control Device article at http://msdn2.microsoft.com/en-us/library/ms867196.aspx.

    As for "shift", I explicitly ignore that in the hook… see the line that includes "&& GetKeyState(VK_SHIFT) >= 0".  You can of course change that as necessary.

  31. Albain says:

    Thanks for your answer, I will have a look at those

  32. Albain says:

    I don’t think it is possible to use your first method, by overriding Wndproc in a Form (or Nativeform) : now addins are loaded into separate process (ehexhost.exe), so assigning the same handle as the ehshell main window does not work.

    I tried to register the remote using the RegisterRawInputDevices in a separate app, and I do receive the remote control commands…as long as I have the focus. If the focus is on media center I don’t receive commands anymore.

    If you have an idea, I would really appreciate your feedback :-)

    Thanks

  33. humperdink says:

    I’ve been playing around some with the source trying to get this to work with my 360 on Vista.  Has anybody figured out how to get the number keys recognized?  

    Using the low level keyboard hook, the left/right/up/down commands come in fine, but numbers come back as Keys.Packet and the actual code doesn’t appear to be encoded in the wparam or lparam.

    Thanks

  34. aaron says:

    any chance this could be enhanced to include a set skip?  something like hitting the left key for an incremental skip but then map it to the up or down arrow and set a value (say 15 mins) and be able to skip in 15 min chunks?  My cable dvr has a 15 min skip and its pretty useful for skipping through a file w/o having to know the exact position you are looking for.

    not that its a huge issue now but its alot of button presses to mimick this functionality (left arrow and then 1 5 0 0) and you have to do that each time to skip 15 mins.  (this is mainly useful for movies since there arent chapter’s on recorded movies or even those ripped to wmv)

  35. toub says:

    The code could certainly be updated to include functionality like that, sure.  It would just be a matter of adding another if/else condition to the hook_KeyDown method.  The code would get a TimeSpan for whatever length of time you wanted (either hardcoded or pulled from some configuration settings) and would do something like this:

     TimeSpan time = TimeSpan.FromMinutes(15);

     TransitionToTime(time);

     ClearInputAndResetTimer();

     DisplayPosition();

  36. toub says:

    Humperdink, I just updated the code so that it does in fact work with the 360 (just tested it).  I’ll have that up on my blog and on MSDN shortly (hopefully).

  37. toub says:

    I’ve updated the source so it should now work with an Xbox 360 extender (at least it does with mine).  Haven’t created a new installer yet.  Hope that helps!

  38. Zeev says:

    Seems like the .msi installer has disappeared, only the source code is in the zip. Where can I get the msi for Visa??

  39. toub says:

    Zeev, see my previous comment, specifically the second sentence:

    "I’ve updated the source so it should now work with an Xbox 360 extender (at least it does with mine).  Haven’t created a new installer yet."

    So there isn’t an MSI right now.  For now you can manually use gacutil.exe and RegisterMceApp.exe.

  40. Zeev says:

    Thanks for your reply.

    Given I’m a U*nix person, can you please elaborate on the use of gacutil.exe and RegisterMceApp.exe to enable me to install the Addin on my Vista MC?

    Thanks.

  41. toub says:

    Hi Zeev-

    If you have the .NET Framework SDK installed, you’ll have gacutil.exe (you can also just copy it from a machine that has the .NET 2.0 SDK).  If you have it, you just do:

       gacutil.exe -i DllPath

    to install the assembly into the GAC (see the docs for more info if you like).  Once it’s in the GAC, you register it with Media Center, with the RegisterMceApp tool in %windir%ehome:

       RegisterMceApp /allusers XmlRegFile

    where the XmlRegFile is the .xml file I included with source and binaries.

    If you don’t have the .NET Framework SDK, Ryan Hurst has posted directions for how to install it without gacutil:

    http://unmitigatedrisk.com/archive/2007/03/17/38.aspx

    I’ll try to create an MSI shortly, but in the meantime, that should work.

  42. John Kennedy says:

    Any eta on a possible msi for this. It would be incredibly useful for me. I have never used .net SDK, so I tried Ryan Hurst’s method. Well after running through the Vista permissions maze for over an hour, I finally found it easier to teach myslf how to use the gacutil. I followed the steps and was told they were successful on both counts. I am now in MCE, but when I push my right arrow I get nothing.

  43. John Kennedy says:

    Okay, so I wasn’t pushing enter after right arrow/time ahead. DUH! Thank you very much for this great add-in!

  44. Michael says:

    Great job, and I wonder why this is not a part of a standard MCE. How difficult would it be to add some visuals: when you punch the keys, you don’t see anything on the screen, only the result when you hit Enter. It would be nice to show some symbols and digits as you punch the keys on the remote control.

  45. toub says:

    Thanks, glad you like it!  Unfortunately, adding visuals given what’s currently available would be pretty tough; not necessarily impossible, but I guarantee there would be quite a bit of hackery involved.

  46. sjgore says:

    Hi, This is exactly what I’ve been looking for, but I can’t find a MSI file in the zip file in the link at the top of the page. Just lots of source files by the look of it. How do I install it? Steve.

  47. Telstar says:

    .msi installer is missing in the zip

  48. Faustt says:

    The MSI file seems to be missing from the zip package for me as well. All I see is source code. What program do I need to use to compile this?

  49. Matthew says:

    Toub, still no MSI file in the zipped package. Any chance you can fix that? I’m dying to be able to skip ahead.

    Thank you!

  50. Fredoc says:

    Same demande !

    I tried to install it with gacutil, I followed all the instructions, evrything was OK. But it still doesn’t work.

    I really need the MSi file. Pleeeease !

    Thank you

    (sory for the mistakes, I’m french !)

  51. gjrober says:

    Hi there,

    This worked for me on my Vista pc. Then I’ve upgraded to Vista SP1 and also installed the TV Pack. And now I can’t get this to work.

    How can I unregister the xml and the dll to stert over again please?

    Alternatively an MSI would be great please.

  52. Jeff says:

    Yea, I could not get it to work with the TV pack either. It works perfect without the TV pack. Shame really, the TV pack finally fixed the errors with channel changing and different resolutions. I would gladly pay for this utility.

  53. Stephen says:

    I can confirm – this doesnt work with the TV pack installed. Is there a workaround for this?

  54. R P says:

    I too failed to get this working after installing TV Pack. I unregistered using the /u option but still can’t get it to work again. Any help here is greatly appreciated.

  55. Rick says:

    I am having problems getting this plug-in to work with vista home premium 64-bit.  I have installed it using the following instructions.

    Copy the contents of the debug folder to Program FilesMCEPosition Changer Add-In

    Open a command window with administrative privliges

    cd windowsehome

    fsutil hardlink create PositionChangerAddIn.dll "Program FilesMCEPosition Changer Add-InPositionChangerAddIn.dll"

    cd "Program FilesMCEPosition Changer Add-In"

    "windowsehomeRegisterMCEApp.exe" /allusers "PositionChangerAddInReg.xml"

    Restart all of your Media Center Sessions…

    I have installed it using the program files folder and the program files (x86) folder.  I don’t have the TV Pack installed.  thanks for any help.  

  56. Alex says:

    The download of the PositionChangerAddIn no longer works, I get a 404 error on the url http://toub.members.winisp.net/Code/PositionChangerAddIn_Vista.zip.

    I’m interested in the nice plug-in. Will the plug-in be back later?

  57. Tom Prendergast says:

    PLEASE PLEASE PLEASE make this available for download again. I just upgraded my HTPC to Vista and the one thing I am missing is this! I had it for XP and I thought it was the greatest thing ever! Please put the file back up for download somewhere or if you dont want to, I will host it for you if you would like, just email me – tprendergast311@yahoo.com. Thanks!

  58. toub says:

    I’m glad you enjoyed it.  It’s attached to this post:

    http://blogs.msdn.com/toub/attachment/1409370.ashx

  59. Tom Prendergast says:

    Thanks so much for the quick response but there doesn’t seem to be an .msi file in this zip as mentioned in your instructions. Does this need to be compiled or something? Not to sound like a complete idiot, but I have no idea how to do that if that is the case. Let me know the easiest way for me to install. Thanks again!

  60. Tom Prendergast says:

    Okay that was really easy, worked like a charm. Thanks so much!

  61. Marvin says:

    Hi Stephen;

    Many thanks for the great add-in’s!

    I can’t seem to find the version for MCE 2005.

    I’d like to have the original ‘full featured’ one for 2005 – any chance you can post a link?

    Thanks!

  62. Matt says:

    Hi Stephen,

    Any way you can make this great add-in to work with TVPack? I am missing this feature so much. Thanks

  63. toub says:

    Hi Matt-

    I haven’t tried out the TVPack, and most likely I won’t have the time to do such an update.  If I do, however, I’ll certainly post about it.  Thanks for the interest.

  64. Matt says:

    Thanks Steve. Just so you know, even though this add-in doesn’t work with Vista with TVPack, it apparently works with Windows 7. Great product. Thanks again.

  65. Spen says:

    Hi Matt, have you actually tried in windows 7? I can’t get it to work.

    I can’t believe microsoft didn’t impliment something like this as standard for Media center.

  66. Jonny says:

    Just for internest sake working on Windows 7 RTM – no problem what so ever

  67. Mike says:

    Isn’t this already in Win7?? Just enter a number and hit either the FF/RW or Back/Fwd button to skip.