Like ResizeEnable does for resizing the window border of normally unresizable windows, I search for a program which re-enables the maximize button or adds such an option to the right click menu of any window.
2 Answers
Although this solution won't add requested menu items, it will add all the functionality to keyboard shortcuts:
- Win+Page Up - maximize window
- Win+Page Down - minimize window
- Win+Home - restore window
- Win+End - close window
So you get all top-right icons covered.
Maximize/minimize/restore work also if window has no menu or if these operations are disabled in menu.
And implementation? Install AutoHotKey and copy the following macros to your .ahk file – here is step-by-step guide for another set of macros.
Feel free to associate the macros to different key shortcuts – I used the above ones because they do not collide with other shortcuts, they address system behavior so Win+key is adequate and also there is certain logic which can be found in their assignment.
#Home:: WinRestore A Return #PgUp:: WinRestore A WinMaximize A Return ;Alt+Win+PgUp mimicking maximize but giving the window custom size !#PgUp:: WinRestore A WinMove, A,, 0, 0, 1600, 838 Return #PgDn:: WinMinimize A Return #End:: WinClose A Return
The advantage of AutoHotKey-based solutions is their flexibility and extensibility – you can adjust them according to your needs, make them working only inside some applications or add advanced functionality (send key presses/mouse clicks, launch applications/DLL's, take inputs, work with clipboard, scan screen, introduce timing – virtually everything) No other Windows app is flexible enough to give you this in full range.
EDIT: Regarding maximized window overlapping the taskbar
What you observe is standard behavior of windows which have "Always On Top" attribute set (you know them, they always float above other windows). Windows maximizes them to overlap the taskbar. (Anyway, they are always on top of it :). Standard windows maximize leaving the taskbar uncovered – at least where I tested it.
Well, you can workaround that behavior by resizing instead of maximizing: I have added Win+Alt+Page Up as example to show the approach. Instead of fixed values you can use a %variable%
filled using SysGet command (with MonitorWorkArea sub-command) to get actual screen area size.
You can also use if...else so original Maximize command (Win+Page Up) will perform either maximization or resizing – depending on whether window is Always On Top. See WinGet command to determine Always On Top flag of the window. (Supply "A" as WinTitle to refer to currently active window.)
Numerous examples in AHK help and on the web can help you coin sequence of the commands doing exactly what you need.
-
It's about non-resizable windows, I don't think this will maximize those.– RayApr 21, 2014 at 21:56
-
@PacMani – No worries, what I gave you is well-tested also for non-resizable windows. :) I added the information to the answer.– miroxlavApr 21, 2014 at 22:27
-
Ah great, seems to work indeed, however a maximized window overlaps the taskbar :(. I try it for a special window if I'm at home, I hope it works there too (it normally uses custom movement handling, but I don't think that will prevent AHK from maximizing it).– RayApr 22, 2014 at 6:59
-
@PacMani – there is a solution – please see recently added EDIT part of the answer– miroxlavApr 22, 2014 at 8:38
-
That's good. I have to find out how to use the system metrics yet. Is there also a possibility to remove the blatant border around a maximized window?– RayApr 22, 2014 at 8:39
Wrote an AutoIt script which maximizes the window with the title specified in the script. It is required to enable the maximize button before maximizing it (or the window will stretch over the taskbar when maximizing it). You can double click the window title bar to restore / maximize it after this - clicking the maximize button doesn't do anything though.
Use Windows+PageUp to maximize any window and Windows+PageDown to restore it.
#include <winapi.au3>
#include <windowsconstants.au3>
HotKeySet("#{PGUP}", "Maximize")
HotKeySet("#{PGDN}", "Restore")
While 1
Sleep(50)
WEnd
Func Maximize()
$handle = WinGetHandle("[ACTIVE]")
;Add maximize button if not available (required for correct window size)
$style = _WinAPI_GetWindowLong($handle, $GWL_STYLE)
If Not(BitAND($style, 0x00010000)) Then
$style += 0x00010000
_WinAPI_SetWindowLong($handle, $GWL_STYLE, $style)
EndIf
;Maximize the window
WinSetState($handle, $GWL_STYLE, @SW_MAXIMIZE)
EndFunc
Func Restore()
$handle = WinGetHandle("[ACTIVE]")
;Restore the window
WinSetState($handle, $GWL_STYLE, @SW_RESTORE)
EndFunc
Optimization ideas: Check if the current window style makes sense to add a maximize button to (some are incompatible, add the other required yet missing styles to it too).