Detect if active window is full screen or not
Detect if active window is full screen or not
How can I do this? I am so lost with this. I have been trying this for a week but without any result.
- MilesAhead
- Posts: 232
- Joined: 03 Oct 2013, 09:44
Re: Detect if active window is full screen or not
Searching I came across this thread: https://autohotkey.com/board/topic/3888 ... plication/
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."
- MilesAhead
name on it and take the blame."
- MilesAhead
Re: Detect if active window is full screen or not
it's simple. You just need to find a color specific to full-creen (or not full screen). For exemple on full-screen I see the red cross yo close the chrome window, full screen is white.
You find all the info needed in the windows spy tool
You find all the info needed in the windows spy tool
Code: Select all
; put the mouse on the right top corner of the screen, freeze the spy tool, copy past the relative position (1357, 6 ).
PixelGetColor ColorWin, 1357, 6 RGB ; get the color of this area
; In my case this part should be white in full screen
if (ColorWin!="0xFFFFFF") ; if it's white (= fullscreen is OFF)
send {f11}; then press f11 to activate fullscreen
Re: Detect if active window is full screen or not
By comparing window positions/styles when the screen is/isn't fullscreen, I found some information, that could be used to identify whether or not the screen is fullscreen.
Code: Select all
q:: ;window - get info
WinGetPos, vWinX, vWinY, vWinW, vWinH, A
WinGet, vWinStyle, Style, A
WinGet, vWinExStyle, ExStyle, A
vOutput := Format("x{} y{} w{} h{}", vWinX, vWinY, vWinW, vWinH)
vOutput .= "`r`n" Format("{},{},{},{}", vWinX, vWinY, vWinW, vWinH)
vOutput .= "`r`n" Format("0x{:08X} 0x{:08X}", vWinStyle, vWinExStyle)
Clipboard := vOutput
MsgBox, % vOutput
return
;e.g. screen dimensions
;1280,720
;e.g. Media Player Classic
;maximised: -8,-8,1296,696 0x15CFC000 0x00000110
;fullscreen: 0,0,1280,720 0x150BC000 0x00000018
;e.g. Internet Explorer:
;maximised: -8,-8,1296,696 0x17CF0000 0x00000100
;fullscreen: 0,0,1280,720 0x170A0000 0x00000000
;maximised style: 0xC00000 ;WS_CAPTION := 0xC00000
;maximised style: 0x40000 ;WS_THICKFRAME := 0x40000
;maximised ex. style: 0x100 ;WS_EX_WINDOWEDGE := 0x100
w:: ;window - is fullscreen?
WinGetPos, vWinX, vWinY, vWinW, vWinH, A
WinGet, vWinStyle, Style, A
WinGet, vWinExStyle, ExStyle, A
vRet := ("0,0," A_ScreenWidth "," A_ScreenHeight = Format("{},{},{},{}", vWinX, vWinY, vWinW, vWinH))
MsgBox, % "is fullscreen: " (vRet ? "y" : "n")
vRet := !(vWinStyle & 0xC00000 = 0xC00000) ;WS_CAPTION := 0xC00000
MsgBox, % "is fullscreen: " (vRet ? "y" : "n")
vRet := !(vWinStyle & 0x40000) ;WS_THICKFRAME := 0x40000
MsgBox, % "is fullscreen: " (vRet ? "y" : "n")
vRet := !(vWinExStyle & 0x100) ;WS_EX_WINDOWEDGE := 0x100
MsgBox, % "is fullscreen: " (vRet ? "y" : "n")
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Detect if active window is full screen or not
What I want to do is, if an active window is not full-screen then take an active window screen shot and if it is full-screen then take a screenshot. I need help though:
Code: Select all
w:: ;window - is fullscreen?
WinGetPos, vWinX, vWinY, vWinW, vWinH, A
WinGet, vWinStyle, Style, A
WinGet, vWinExStyle, ExStyle, A
vRet := ("0,0," A_ScreenWidth "," A_ScreenHeight = Format("{},{},{},{}", vWinX, vWinY, vWinW, vWinH))
WinGet, Style, Style, My Window Title
if (Style & 0x8000000) ; 0x8000000 is WS_DISABLED.
{
Send ![Printscreen]
}
else {
Send [Printscreen] ; or check if 0x8 is WS_EX_TOPMOST
}