2

I'm trying to use Python to lock my computer. The only way I know to do this via keystrokes is by holding down the "Windows button" and pressing the "L" key. However, I can't figure out how to do this with Pywin32.

I found an extensive list of Pywin32's available keys: http://win32com.goermezer.de/content/view/136/254/ (But it doesn't include the "Windows button," so I'm still stuck.)

Any suggestions?

2
  • There are a few other functions I'd like to (but don't have to) have the ability to do that require the Windows key. Commented Aug 8, 2013 at 3:05
  • I now have it where I can use the Windows key, except it doesn't work in combination with letters (but it does work with the other keys like the "right arrow"). LINK: pastebin.com/Ew21FASU Commented Aug 8, 2013 at 7:03

1 Answer 1

4

From Tim Golden's pages:

import ctypes
ctypes.windll.user32.LockWorkStation()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.