Getting machine to go to sleep under Vista

I was having a strange problem getting my computer to go to sleep under Vista. When my laptop was not plugged in, it would go to sleep fine when I closed the lid. However, when my laptop was plugged in and I losed the lid, it would lock but not go to sleep.

I finally figured out what was going on. In the advanced power options, there's a Multimedia settings->When sharing media section. By default, it was set "Prevent idling to sleep" when plugged in. I think Windows Media Player had media sharing on. I switched the option and now it sleeps fine!