How to make right click on the restore down button on any window

Viewed 18

I would like to build a Utility that enables me to right click a window on the "Restore Down" and always have it downsized into a fixed size and location on the screen.

I found an Open Source utility that enables me to right click the minimize button and have it reduced into the the icon tray and I would like to add my utility to the existing one.

link to the existing utility repos: https://github.com/benbuck/rbtray

I'm looking for a direction where to start on this little project.

1 Answers

Oh that's easy

Python has in-build modules like win32gui, win32con, which makes this thing really easy.

1. To Maximize Window:

import win32con, win32gui
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)

2. To Minimize Window:

import win32con, win32gui
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)

3. To restore down window (Normal)

import win32gui, win32con
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_RESTORE)

Cheers, athrv.

Related