The window doesnt fit in the screen

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DRS
Posts: 6
Joined: 10 Feb 2021, 17:40

The window doesnt fit in the screen

14 May 2024, 20:33

Hi, I use a Stardock app that let me hide de taskbar in windows, but now I have an issue with a script that set windows with a command in the half screen. The window doesnt fill at the end of the screen.
image.png
image.png (358.34 KiB) Viewed 513 times
I mean this space at the end of the screen.

This is my script right now:

Code: Select all

+#z::    ;; left half screen
 #z::    ;; right half screen
   hWnd := WinExist("A")
   WinGet, MinMax, MinMax
   if MinMax
      WinRestore
   WinGetPos,, Y_TaskBar,,, ahk_class Shell_TrayWnd
   dX := dW := dH := 0
   VarSetCapacity(RECT, 16, 0)
   if DllCall("Dwmapi\DwmGetWindowAttribute", Ptr, hWnd, UInt, DWMWA_EXTENDED_FRAME_BOUNDS := 9, Ptr, &RECT, UInt, 16) = 0  {
      WinGetPos, X, Y, W, H
      dX := NumGet(RECT, "Int") - X
      dW := X + W - NumGet(RECT, 8, "Int") + dX
      dH := Y + H - NumGet(RECT, 12, "Int")
   }
   WinMove,,, (A_ThisHotkey =  "+#z" ? 0 : A_ScreenWidth//2) - dX, 0, A_ScreenWidth//2 + dW, Y_TaskBar + dH
   Return
What I have to change to fill the space to the end of the screen?
Thans for your help.


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod action: Topic moved from "Scripts and Functions (v1)" which is for sharing working scripts, not for asking for help with your scripts.]
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: The window doesnt fit in the screen

14 May 2024, 20:51

@DRS -- Please put [code][/code] tags around your code when posting a script on the forum. And please ask questions in "Ask for Help" (where this thread was moved to), not in "Scripts and Functions" which is for sharing working scripts, not for getting help with scripts.
Rohwedder
Posts: 7732
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: The window doesnt fit in the screen

17 May 2024, 00:22

Hallo,
if the Stardock app really hides the taskbar:

Code: Select all

+#z::    ;; left half screen
#z::    ;; right half screen
hWnd := WinExist("A")
WinGet, MinMax, MinMax
if MinMax
	WinRestore
WinGetPos,, Y_TaskBar,,, ahk_class Shell_TrayWnd
if !Y_TaskBar ; if Stardock App has hidden the taskbar
	Y_TaskBar := A_ScreenHeight
dX := dW := dH := 0
VarSetCapacity(RECT, 16, 0)
if DllCall("Dwmapi\DwmGetWindowAttribute", Ptr, hWnd, UInt, DWMWA_EXTENDED_FRAME_BOUNDS := 9, Ptr, &RECT, UInt, 16) = 0
{
	WinGetPos, X, Y, W, H
	dX := NumGet(RECT, "Int") - X
	dW := X + W - NumGet(RECT, 8, "Int") + dX
	dH := Y + H - NumGet(RECT, 12, "Int")
}
WinMove,,, (A_ThisHotkey =  "+#z" ? 0 : A_ScreenWidth//2) - dX, 0, A_ScreenWidth//2 + dW, Y_TaskBar + dH
Return
or if the Stardock app did something strange:

Code: Select all

+#z::    ;; left half screen
#z::    ;; right half screen
hWnd := WinExist("A")
WinGet, MinMax, MinMax
if MinMax
	WinRestore
dX := dW := dH := 0
VarSetCapacity(RECT, 16, 0)
if DllCall("Dwmapi\DwmGetWindowAttribute", Ptr, hWnd, UInt, DWMWA_EXTENDED_FRAME_BOUNDS := 9, Ptr, &RECT, UInt, 16) = 0
{
	WinGetPos, X, Y, W, H
	dX := NumGet(RECT, "Int") - X
	dW := X + W - NumGet(RECT, 8, "Int") + dX
	dH := Y + H - NumGet(RECT, 12, "Int")
}
WinMove,,, (A_ThisHotkey =  "+#z" ? 0 : A_ScreenWidth//2) - dX, 0, A_ScreenWidth//2 + dW, A_ScreenHeight + dH
Return
DRS
Posts: 6
Joined: 10 Feb 2021, 17:40

Re: The window doesnt fit in the screen

24 May 2024, 20:03

Thank you! the second script worked great!

Sorry for the mistakes and for being slow, but I have a lot to learn.

Thank you all for your patience.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Cerulium, feiy, hitman and 100 guests