On Windows XP :
You'll have to right click on the desktop , Choose Properties , Then choose screensaver tab on the upper window. From there you can set the time when the computer will go to " Screensaver " Or " Hibernate " mode when it's idle.
To enable password protection after the computer goes out of " Screensaver " Or " Hibernate Mode " Check " Enable Password Protection " Located next to the Minutes.
It will ask you for a password every time the computer goes back to it's active mode after doing this.
Hope I've played.