What worked for me is setup the sleep button to do nothing in Windows power settings. It still wakes up the HTPC (it's a hardware event), but doesn't send it to sleep. The off button on the remote will then power off the display and the receiver, and the HTPC will go to sleep in 10 minutes of so if nothing is playing. I like your method, but I often use the MCE IR keyboard and wouldn't want to lose its on/off function. I would probably modify the off rather than the on code, though.