Put Window over Taskbar

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Put Window over Taskbar

28 Apr 2018, 00:17

hi buds,

ive got a script to remove window borders when i hold right wondows and left click, i use it for games.
there is just the problem that the taskbar is over the game window, i want the taskbar behind.

my window resolution is 3440x1440 so the game will not be fullscreen.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

; Exclude the desktop
; Note: Also excludes "My Computer" browsing windows.
;       Better detection might be needed to differentiate the parent explorer "ahk_id" from child windows.
;       Also seems to disregard accidental Metro interface clicks (Win 8+)
#IfWinNotActive ahk_exe explorer.exe

; Set your resolution (minus decorations like start bars if you wish to leave those on-screen.
w = 2560
h = 1440
w_wasted = 6 ; width used by resize bars
h_wasted = 29 ; width used by caption frame and resize bars

; Window to fullscreen
RWIN & LButton::
  SetTitleMatchMode, 2
  WinGet Style, Style, A

  ; 0xC40000 = WS_BORDER (0x800000) + WS_DLGFRAME (0x400000) + WS_SIZEBOX aka WS_THICKFRAME (0x040000)
  if(Style & 0xC00000) { ; if has WS_CAPTION. Ignore sizebox value.
    WinGetPos, X, Y, Width, Height, A
    WinSet, Style, -0xC40000, A ; removes attributes, including sizebox...doesn't do a strict subtraction
    WinMove,A,,0,0,w,h
  } else {
    WinSet, Style, +0xC40000, A
 ;   WinSet, AlwaysOnTop
    ; Note: will set WS_SIZEBOX even if not previously present
    if(Width > w - w_wasted) { 
      Width := %w%-%w_wasted%
    }
    if(Height > h - h_wasted) {
      Height := %h%-%h_wasted%
    }
    WinMove,A,,%X%,%Y%,%Width%,%Height%
  }
  WinSet Redraw
return
User avatar
YoucefHam
Posts: 372
Joined: 24 Aug 2015, 12:56
Location: Algeria
Contact:

Re: Put Window over Taskbar

28 Apr 2018, 14:43

add

Code: Select all

WinSet, AlwaysOnTop, On, A
:wave: There is always more than one way to solve a problem. ;)
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: Put Window over Taskbar

28 Apr 2018, 15:09

yeah that works, but its then always on top.
is there a way when i alt + tab that other windows are then over the main window? or if i switch to browser window.
can it just stay on top while its active somehow?
User avatar
YoucefHam
Posts: 372
Joined: 24 Aug 2015, 12:56
Location: Algeria
Contact:

Re: Put Window over Taskbar

28 Apr 2018, 15:55

try this

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

; Exclude the desktop
; Note: Also excludes "My Computer" browsing windows.
;       Better detection might be needed to differentiate the parent explorer "ahk_id" from child windows.
;       Also seems to disregard accidental Metro interface clicks (Win 8+)
#IfWinNotActive ahk_exe explorer.exe

; Set your resolution (minus decorations like start bars if you wish to leave those on-screen.
w = 2560
h = 1440
w_wasted = 6 ; width used by resize bars
h_wasted = 29 ; width used by caption frame and resize bars

; Window to fullscreen
RWIN & LButton::
SetTitleMatchMode, 2
WinGet Style, Style, A

; 0xC40000 = WS_BORDER (0x800000) + WS_DLGFRAME (0x400000) + WS_SIZEBOX aka WS_THICKFRAME (0x040000)
if(Style & 0xC00000) { ; if has WS_CAPTION. Ignore sizebox value.
	WinGetPos, X, Y, Width, Height, A
	WinSet, Style, -0xC40000, A ; removes attributes, including sizebox...doesn't do a strict subtraction
	WinMove,A,,0,0,w,h
} else {
	WinSet, Style, +0xC40000, A
	;   WinSet, AlwaysOnTop
	; Note: will set WS_SIZEBOX even if not previously present
	if(Width > w - w_wasted) { 
		Width := %w%-%w_wasted%
	}
	if(Height > h - h_wasted) {
		Height := %h%-%h_wasted%
	}
	WinMove,A,,%X%,%Y%,%Width%,%Height%
}
WinSet Redraw

;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

WinGetTitle, Game_Title, A
WinSet, AlwaysOnTop, On, % Game_Title
SetTimer, Game_Check, 1000  ;do "Game_Check" every 1 sec
return

Game_Check:
IfWinNotActive, % Game_Title
{
	if (ExStyle & 0x8)  ; is the window always-on-top?
		WinSet, AlwaysOnTop, Off, % Game_Title
}
else
{
	if !(ExStyle & 0x8)  ; is the window always-on-top?
		WinSet, AlwaysOnTop, On, % Game_Title
}
return

;////////////////////////////////////////////////////
:wave: There is always more than one way to solve a problem. ;)
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: Put Window over Taskbar

29 Apr 2018, 06:03

its strange,

when i hold rwin and click its borderless behind the taskbar, then i need to do it again then its windowed but in front of the taskbar, then i do it again its borderless over the taskbar how it should stay
but when i want to opoen an other window, all oterh windows are behind then

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: hiahkforum, NullRefEx, ShatterCoder and 106 guests