[python-win32] Waiting for process & Intercepting Keys
Tim Golden
tim.golden at viacom-outdoor.co.uk
Tue Jan 13 04:24:19 EST 2004
>-----Original Message-----
>From: Steven M. Faulconer [mailto:geek at cfl.rr.com]
>Hello everyone,
>
> I'm my continuing drive to use Python more on our Windows
> systems, I've written a number of scripts to do certain tasks.
> One script is setup to do some time recording for usage
> information of the system. For the most part, the script works
> fine, but part of the script also locks the screen, and that
> is where I am having some minor issues. Please take
> note that I'm still a beginner, so I'm sure this is ugly:
>
> os.system("rundll32.exe user32.dll,LockWorkStation")
I realise that you didn't ask for this, but this could
slightly more cleanly be done like this, using ctypes
(http://starship.python.net/crew/theller/ctypes/)
import ctypes
ctypes.windll.user32.LockWorkStation ()
> This command will lock the work station correctly, the problem
> is I need the script to pause until the screen is unlocked.
This looks to be really quite tricky. Technically you could
install a Windows system hook, but I don't think they've been
wrapped for Python (altho' again ctypes is a possibility) but
I've always managed to avoid them, because hooking in to the
O/S as such a low level makes me nervous.
I'll try to have a look at a WMI-based solution, because that
makes it easy to track process creation/death, but I don't
think a new process is in fact created; I think it's the
always-running winlogon.exe which is doing the business.
Sorry not to be any more help than that.
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-win32
mailing list