Robinson
Robinson

Reputation: 379

Pywin32 SendKeys: "Windows button" keypress

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?

Upvotes: 2

Views: 3813

Answers (1)

Steve Barnes
Steve Barnes

Reputation: 28425

From Tim Golden's pages:

import ctypes
ctypes.windll.user32.LockWorkStation()

Upvotes: 4

Related Questions