Easy way to use windows dlls with python.
Project description
🚀 WinDll 0.1.0
🔥 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 (
SendInputwrapper) - 🖱️ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3908faa02bae67fbbdb321eb796d9705a25c4911962903fde804049a2c416b72
|
|
| MD5 |
0b4fba5817920b1ceb3e5fca54a06ae1
|
|
| BLAKE2b-256 |
51fed03e7e6c84af1c779dc4bbbd739ad9a3f684bfa2b8e83f966e86435600d4
|
File details
Details for the file windll_python-0.1.0.post1-py3-none-any.whl.
File metadata
- Download URL: windll_python-0.1.0.post1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
586b106787bd1b4e228241dc44a8cfd1751408a55e6ccf9386abf06a06917a0f
|
|
| MD5 |
583ef69982e3b1cb08020fd5b16a3558
|
|
| BLAKE2b-256 |
685820d8de79ce519832d5d12a670b9abe7f1ce70d96dfdbbd734421a4c00223
|