Start -> Control Panel -> Power Options (right side) -> Choose what power buttons do (left menu)
Where it says: When I press the power button
Set to: “Do nothing”
Where it says: When I press the sleep button
Set to: “Do nothing”
Click on “Save Changes” at the bottom.
XP:
Start -> Control Panel -> Power Options
Select the “Advanced” tab at the top of the Power Options box.
Where it says: When I press the power button on my computer
Set to: “Do nothing”
Where it says: When I press the sleep button on my computer
Set to: “Do nothing”
Click on "Apply"
