Python calls the Windows API lock computer example

  • 2020-04-02 13:33:00
  • OfStack

Call the Windows API to lock the computer

Python32 was intended to be called directly from Python32, but no Windows API LockWorkStation() was found.

Therefore, the Windows DLL is called directly


#!/usr/bin/env python
#-*- coding:cp936 -*-
" call WindowAPI Locking computer "
import ctypes;
dll = ctypes.WinDLL('user32.dll');
dll.LockWorkStation();


Related articles: