• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1120
  • Last Modified:

How to automatically lock Windows 7 after configurable time without using Windows Screen saver

I have a user that is using a fax program that needs to disable the Windows 7 Screen saver (too CPU intensive and will starve comm. threads for fax receive they say).  Fax program works great other than this and do not want to change this program.

Also, the fax program will not work if you log off the computer.  You are only allowed to use the Windows "Lock" for security.

The issue is the user wants to have an automatic way to lock the Windows 7 computer (after 30 minutes for example).  They are using manual Start -> Shutdown -> Lock method now but need automatic method.

Is there a way to do this natively in Windows 7?  If not, is there a good free or inexpensive paid program to do this?

1 Solution
MichaelSystems EngineerCommented:
There is a simple way to do this without installing anything. You can do this by holding the Windows key and pressing the L key. This will immediately lock the computer.
rdwolfAuthor Commented:

The need is to do this automically  when the user steps away from desk for greater than 30 minutes. They already know how to do manual method.

So I am still looking for an automatic locking method as stated.

Sean MeyerCommented:
Here is a locking exe i wrote in autoit, which is a freeware program you can get here
I have included the pre-compiled exe, an ini file, and the source code which you can compile yourself if you don't want to run my exe.
The exe and the ini file need to be in the same directory. The program defaults to lock at  15 minutes which is 900,000 MS
If you want the computer to autolock at 30 minutes set the "time = " section in the ini file to 3,600,000
This program will also create a shortcut in the %username%\startup folder so that it will persist across reboots.
It will work with win 7 and xp.
If you want to kill the program hitting the ESC will shut it down.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayIconHide", 1)
#include <Timers.au3>
$IdleMinimum  = IniRead(@ScriptDir & "\time.ini", "time", "time", "")
HotKeySet("{ESC}", "_Quit")

if $IdleMinimum  = "" then $IdleMinimum = 900000; Idle time in milliseconds
case	@OSVersion  = "WIN_7"
if not FileExists("C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk")Then
FileCreateShortcut(@scriptdir & "\lock.exe","C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk",@scriptdir)
case    @OSVersion  = "WIN_XP"
if not FileExists("C:\Documents and Settings\" & @username & "\Start Menu\Programs\Startup\lock.lnk") Then
FileCreateShortcut(@scriptdir & "\lock.exe","C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk",@scriptdir)

While 1
    If _Timer_GetIdleTime() >= $IdleMinimum Then
		Run(@COMSPEC  & " /c" & " rundll32.exe user32.dll, LockWorkStation","",@SW_HIDE)
        Until _Timer_GetIdleTime() < $IdleMinimum

Func _Quit()
EndFunc  ;==>_Quit

Open in new window

rdwolfAuthor Commented:
Thanks for the solution.

I actually ended up just using the Windows 7 screen saver with lock.  I tuned off the screen saver so the computer will lock, after specified time, and now screen saver will come up using CPU cycles that the Fax program can not work with for receive fax queues.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now