I remember that being doable years ago with either a Nokia or a Sony Ericsson T610, but I can't remember how. Some of the standard software it came with I think.
From: 99% of gargoyles look like (MR_BASTARD) 2 Feb 2012 09:02
Start Menu, type "power" and pick, I think, power options. I think you should be able to take it from there. You can change the behaviour of closing the lid on battery or AC power.
From: 99% of gargoyles look like (MR_BASTARD) 2 Feb 2012 09:53