You should always lock your computer when you leave it. A password will protect your computer from others. There are three or four methods to lock your computer manually, but you can lock your computer automatically using screen saver option. You can turn on automatically lock dialog box after specified time.
Follow the giving steps to set screen saver to lock computer automatically:
First right click on your computer desktop then select the properties option.
In the Display Properties click on Screen saver tab.
Now select any screen saver file then in Wait field set any suitable time to turn on screen saver.
At the end check the Password Protected option and press OK. Now after specified time, when your screen saver will turn on, your computer will be automatically locked.