There is an option for Windows to prompt for a password when the computer resumes from Standby or Hibernatation – for me this option is usually not convenient for tablet/laptop use.
Do you really care that the system suspended (after a few minutes on a ‘long-life’ power setting…)? – or do you care how long it has been suspended? I tend to care about how long it has been suspended. I like my Toshiba R10 tablet to go into Standby fairly quickly when I am running on batteries (for long meetings…), if my tablet has only been suspended for a few minutes I do not want to be forced to put in a password when it resumes (especially when I need to quickly take notes or look up information!). On the other hand, if my computer has been Suspended (either Hibernate or Standby) for 45 minutes it seems 100% appropriate to be prompted for a password since it is likely I am either not around or not paying any attention to it.
I have not found a way to trigger a password prompt based on the amount of time Suspended so I wrote a small application – WARNING THIS SOFTWARE IS LARGELY UNTESTED AND VERY BETA:
This application sits in the system tray – it records the time that the system Suspends and on Resume looks at the number of minutes that have elapsed. If the elapsed number of minutes is greater than a number of minutes set by the user the workstation is locked.
This is not meant as a hard-core high-security solution, I am sure that there are many trivial ways to bypass it on Resume – no chance this would foil serious hackers. On the other hand, it makes casual data theft/snooping much harder (especially combined with programs like TrueCrypt), while letting the system resume without a password in situations where it is useful and convenient – the idea here is to strike a useful balance of security and convenience…
Some things I learned –
This is a really simple application. It really comes down to just two lines of code (the source is available for download to see these in context):
AddHandler SystemEvents.PowerModeChanged, AddressOf powerModeTracker
(which is an easy way to catch the Suspend event)
Declare Function LockWorkStation Lib “user32.dll” () As Boolean
(used to lock the workstation)
I thought about (and am still thinking about) implementing an option to record the time of a Montior Power Down event. I tested this idea with this code:
Private Const WM_SYSCOMMAND As System.Int32 = &H112
Private Const SC_MONITORPOWER = &HF170
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SYSCOMMAND Then
If m.WParam.ToInt32 = SC_MONITORPOWER Then
The code functioned as I expected, but not when the form was hidden or minimized! When hidden or minimized the form never seems to recieve SC_MONITORPOWER. Hopefully I am missing something simple (comments giving me a clue are very welcome – this feels like something I will laugh at myself about when I know the solution), I think it would be a nice additional option.