Skip to content

Instantly share code, notes, and snippets.

@fehC
Last active December 31, 2015 14:49
Show Gist options
  • Save fehC/8002472 to your computer and use it in GitHub Desktop.
Save fehC/8002472 to your computer and use it in GitHub Desktop.
/*
mwa := monitorWorkingArea()
msgBox, % mwa.x " " mwa.y " " mwa.w " " mwa.h
exitApp
*/
monitorWorkingArea()
{
/*
author : Chef
link : http://ahkscript.org/boards/viewtopic.php?p=7194#p7194
date : 13 December 2013 | last modified : 16 December 2013
description
an alternative function to get MonitorWorkingArea since Ahk "MonitorWorkArea" command is not reliable.
credit to SKAN and MilesAhead
*/
VarSetCapacity( APPBARDATA , 36, 0 )
if DllCall( "Shell32.dll\SHAppBarMessage", "UInt", 0x4, "uint", &APPBARDATA ) ; ABM_GETSTATE := 0x4
return {x:0, y:0, w:a_screenWidth, h:a_screenHeight}
; WinGetPos,tbx, tby,tbw, tbh, ahk_class Shell_TrayWnd
; taskbarPos := tbx > 0 ? "right" : (tby > 0 ? "bottom" : (tbh > (a_screenHeight//2) ? "left" : "top"))
taskbarPos := taskbarPos() ; https://gist.github.com/fehC/8002421
return taskbarPos = "top" || taskbarPos = "bottom" ? {x:0, y: (taskbarPos = "top" ? tbh : 0), w:a_screenWidth, h:a_screenHeight-tbh}
: {x:(taskbarPos = "left" ? tbw : 0), y:0, w:a_screenWidth-tbw, h:a_screenHeight}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment