isFullScreen(): Detect if active window is in fullscreen mode

Post your working scripts, libraries and tools.
User avatar
xianii
Posts: 5
Joined: 27 Sep 2014, 12:53
Contact:

isFullScreen(): Detect if active window is in fullscreen mode

Post by xianii » 18 Jan 2022, 03:45

Image

Code on GitHub: https://github.com/Nigh/isFullScreen

Code: Select all

/*! 
    Checks if a window is in fullscreen mode.
    ______________________________________________________________________________________________________________

	Usage: isFullScreen()
	Return: True/False

	GitHub Repo: https://github.com/Nigh/isFullScreen
*/
class isFullScreen
{
	
	static monitors:=this.init()
	static init()
	{
		a:=[]
		loop MonitorGetCount()
		{
			MonitorGet(A_Index, &Left, &Top, &Right, &Bottom)
			a.Push({l:Left,t:Top,r:Right,b:Bottom})
		}
		Return a
	}

	static Call()
	{
		uid:=WinExist("A")
		if(!uid){
			Return False
		}
		wid:="ahk_id " uid
		c:=WinGetClass(wid)
		If (uid = DllCall("GetDesktopWindow") Or (c = "Progman") Or (c = "WorkerW")){
			Return False
		}
		WinGetClientPos(&cx,&cy,&cw,&ch,wid)
		cl:=cx
		ct:=cy
		cr:=cx+cw
		cb:=cy+ch
		For , v in this.monitors
		{
			if(cl==v.l and ct==v.t and cr==v.r and cb==v.b){
				Return True
			}
		}
		Return False
	}
}

Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: isFullScreen(): Detect if active window is in fullscreen mode

Post by Skrell » 28 Nov 2022, 16:16

image.png
image.png (1.54 KiB) Viewed 811 times

Post Reply

Return to “Scripts and Functions (v2)”