Maybe I misunderstood your question but this just adds a "button" in theater view that when selected will immediately put the computer to sleep. Doesn't matter if anything is playing or not.
No this is just fine, I think this is a very valuable feature. I have added the code as you have described above, however, if I click on the button, MC jumps into the desktop mode (for a short moment, then back), but then nothing happens.
I donīt know what the issue is, but looking at the screenshot, it appears it was written for Windows 32bit? I am using Win 8.1. 64bit, so probably some minor changes are necessary?
I actually wrote a small program a while back that has the option to put the computer to sleep after playback stops but was intended to be used to with a 3rd party media management software but allow JRiver to be used for playback. It would actually be a very small change for me to allow it to be run from within JRiver so that it could then put the computer to sleep after playback is finished, if that was what you were actually asking for. http://yabb.jriver.com/interact/index.php?topic=65984.0
Yes, that was my original intention - put it to sleep automatically, after playback has changed. Or maybe 10 minutes after the song/movie has stopped, or the last button was pressed in MC. Actually I cannot see that Windows is doing this on its own. I have setup this in the windows power option, but it seems the HTPC never goes to sleep...