From AHK Forum search:
http://www.autohotkey.com/forum/topic42313.html&highlight=detect+full+screen+mode
animeaime's post in the thread
Ok. This should. I remember how NiftyWindows would always suspend on a full screen program. So, this should do the job. Use WinExist (or some other means) to get the Unique ID (HWND) of the desired window.
isWindowFullScreen(WinID)
{
;checks if the specified window is full screen
;code from NiftyWindows source
;(with only slight modification)
;use WinExist of another means to get the Unique ID (HWND) of the desired window
if ( !WinID )
return
WinGet, WinMinMax, MinMax, ahk_id %WinID%
WinGetPos, WinX, WinY, WinW, WinH, ahk_id %WinID%
if (WinMinMax = 0) && (WinX = 0) && (WinY = 0) && (WinW = A_ScreenWidth) && (WinH = A_ScreenHeight)
{
WinGetClass, WinClass, ahk_id %WinID%
WinGet, WinProcessName, ProcessName, ahk_id %WinID%
SplitPath, WinProcessName, , , WinProcessExt
if (WinClass != "Progman") && (WinProcessExt != "scr")
{
;program is full-screen
return true
}
}
}
edit: I haven't tried it but according to the help you can get the handle of the active window like this: WinExist("A")
so isWindowFullScreen(WinExist("A")) should return true if the active "window" is in full screen mode. At least for single monitor systems anyway.
If it returns true just Send the !{Enter}. If not just eat the key combo.
!Enter::
If isWindowFullScreen(WinExist("A"))
Send, !{Enter}
else
; send something else or just eat the keys
return
Get the simplest case working first before adapting it.
-MilesAhead
I did that; still failed. I asked over at the AHK forum; lots of people read my post, but nobody answered.
Eventually, I came to the comclusion that the reason it didn't work was because a fullscreen DOS app doesn't have the same attributes that are being tested for to detect a fullscreen Windows app, and racked my brains for a while to see if I could come up with an alternative approach.
I discovered that (under XP, anyway) Alt-Enter with the desktop as the foreground app brings up display properties. That led me to a plan...
#IfWinActive, MyCode
; MyCode should be replaced with the appropriate window title -- can be set in a batchfile with Title "<whatever>"
; semi-disable Alt+Enter
!Enter::
SetMouseDelay, 70
click 2000,2000 ; click somewhere far, far away from any open windows
; Alt-enter on desktop brings up XP display properties, in a fullscreen DOS app it pushes it back to a window
send !{Enter}
click 275,430 ; the Cancel button on the XP Display Properties dialog, regardless of tab
WinActivate, MyCode
return
So I don't actually test for the state, I do something that affects both states differently and deal with the outcome -- I click cancel, or I click in the window with the DOS app in it, which just selects it or some text in it depending on whether quickedit mode is on or not. Either way, I have a solution.
I felt quite clever. :D Although I grant it's a lot less elegant than I'd like.
--tim