Skip to main content

Easy way to use windows dlls with python.

Project description

🚀 WinDll 0.1.0

Python License Version GitHub CSDC-K


🔥 What is WinDll?

WinDll is a lightweight Python wrapper around Windows' native user32.dll and kernel32.dll APIs designed to simplify common Windows system tasks such as window management, keyboard/mouse input simulation, process management, and system control.

This library allows Python developers to automate and control Windows OS functions easily without external dependencies, using only ctypes.


🛠 Features

  • 🖥️ Window management (find, move, resize, show/hide, set foreground)
  • ⌨️ Keyboard input simulation (SendInput wrapper)
  • 🖱️ Mouse input simulation (move cursor, click)
  • 🔒 Block and unblock user input (BlockInput)
  • 🧑‍💼 Check if script runs with admin privileges
  • ❌ Kill processes by executable name (pure ctypes implementation)
  • 🚪 Lock workstation or reboot system

📚 Installation

pip install windll-python

💡 Usage Examples

Initialization

from WinDll import User32DLL, Kernel32DLL

winapi = User32DLL()
#or
winapi = Kernel32DLL

Window Operations - USER32

# Close a window by title
result = winapi.DestroyWindow("Untitled - Notepad")
print("Closed successfully" if result else "Window not found")

# Show or hide a window
winapi.WindowsCall(WindowName="Untitled - Notepad", SetShow=True, SHOW=True)  # Show window
winapi.WindowsCall(WindowName="Untitled - Notepad", SetShow=True, SHOW=False) # Hide window

# Set window to foreground
winapi.WindowsCall(WindowName="Untitled - Notepad", SetForeGround=True)

# Move and resize window
winapi.WindowsCall(WindowName="Untitled - Notepad", SetRes=True, ResX=800, ResY=600)
winapi.WindowsCall(WindowName="Untitled - Notepad", SetPlace=True, MoveX=100, MoveY=100)
# Rename Window
winapi.WindowsCall(WindowName="Untitled - Notepad", SetName = True, NewName = "Test - Notepad")

Keyboard Simulation - USER32

# Press and release 'A' key quickly
winapi.KeyboardCall(SetPress=True, SetPressKey=winapi.VK_A)

# Press 'A' key for 2 seconds
winapi.KeyboardCall(SetPress=True, SetPressTime=2.0, SetPressKey=winapi.VK_A)

Mouse Simulation - USER32

# Move cursor to (500, 500)
winapi.CursorCall(SetPos=True, SetPosX=500, SetPosY=500)

# Get current cursor position
pos = winapi.CursorCall(GetPos=True)
print(pos)  # Output: X:xxx Y:yyy

# Left click
winapi.CursorCall(ClickEvent=winapi.LEFT)

# Right click
winapi.CursorCall(ClickEvent=winapi.RIGHT)

Blocking User Input - USER32

# Block mouse and keyboard input for 5 seconds
winapi.WindowCall(SetBlock=True, SetBlockTime=5)

# Unblock input manually
winapi.WindowCall(BrokeSetBlock=True)

Process Management - KERNEL32

# Kill all notepad.exe processes
winapi.KernelCall(process=wina.kernel_PROCESSEXECUTE, ProcessPath="notepad.exe")

# Start Process
winapi.KernelCall(process=wina.kernel_PROCESSCREATE, ProcessPath="path")

Check Admin Rights - USER32

if winapi.WindowsKernelAdminIS():
    print("Running as administrator")
else:
    print("Not running as administrator")

📝 License

This project is licensed under the MIT License.


🙋 Author

CSDC-K VV


⭐ Contributions Welcome!

Feel free to open issues or submit pull requests.


📌 Disclaimer

Use with caution. Some functions (e.g., TerminateProcess, BlockInput) affect system stability or user control.


Enjoy coding with WinDll! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windll_python-0.1.0.post1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

windll_python-0.1.0.post1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file windll_python-0.1.0.post1.tar.gz.

File metadata

  • Download URL: windll_python-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for windll_python-0.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 3908faa02bae67fbbdb321eb796d9705a25c4911962903fde804049a2c416b72
MD5 0b4fba5817920b1ceb3e5fca54a06ae1
BLAKE2b-256 51fed03e7e6c84af1c779dc4bbbd739ad9a3f684bfa2b8e83f966e86435600d4

See more details on using hashes here.

File details

Details for the file windll_python-0.1.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for windll_python-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 586b106787bd1b4e228241dc44a8cfd1751408a55e6ccf9386abf06a06917a0f
MD5 583ef69982e3b1cb08020fd5b16a3558
BLAKE2b-256 685820d8de79ce519832d5d12a670b9abe7f1ce70d96dfdbbd734421a4c00223

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page