As per the configuration of the Windows 7, when ever you press on to the sleep or the power button on your computer or keyboard, your computer will go to sleep.
It is possible that the default configuration is useful for most people; however other people would actually prefer that the power button should shut down the computer system. Many people may wish the sleep button to actually hibernate the computer system rather than just positioning it to sleep mode. Many people may wish to disable either one or both the buttons in order to prevent the actions from taking place in case they are pressed by mistake.
How to change What the Power and Sleep Button do:
1. Choose the “Control Panel” from the “Start” button in Windows 7.
2. In case you are utilizing an expanded Control Panel then choose “Power Options”.
Other than this click “Hardware and Sound”, then choose “Power Options”.
3. After clicking the Power options select “Choose what the power buttons do”.
4. Next to the option “When I press the power button”, select any option that is present beneath “Plugged in” and “On battery”:
* Do nothing
* Shut down
5. After the completion, click on “Save changes” in order to store the settings.