Actually, it turns out that the SetWindowRedraw() approach wasn't working at all (DllCall() resulted in an ErrorLevel of -4, i.e., function not found), hence why I was so quick to dismiss your suggestion... I've since found that DllCall("LockWindowUpdate", ...) works instead:
http://msdn2.microsoft.com/en-us/library/ms534869.aspxPerhaps a difference of OSes? I am using WinXP... I think this does the same thing. Even though it freezes the client area only, it actually makes a huge difference! Thanks for pointing me down this road, skrommel! :up:
Updated code, for those interested:
Spoiler
fs_engaged := 0 ; is "fullscreen" engaged for some window?
padding := 2 ; additional padding width to remove, in pixels
#Enter::
if (fs_engaged = 0) {
ID:=WinActive("A")
hwnd:=WinExist("A")
DllCall("LockWindowUpdate",UInt,hwnd)
WinGetPos, oldX, oldY, oldW, oldH ; save old dimensions
WinSet, Style, -0xC00000, ahk_id %ID% ; remove titlebar/WS_CAPTION
WinSet, Style, -0x40000 , ahk_id %ID% ; remove borders/WS_SIZEBOX
WinSet, AlwaysOnTop , On, ahk_id %ID%
;; work out current desktop resolution
SysGet, m, Monitor
desk_width := mRight - mLeft
desk_height := mBottom - mTop
WinMove, ahk_id %ID%,, -padding,-padding
,desk_width+2*padding, desk_height+2*padding
DllCall("LockWindowUpdate",UInt,0)
fs_engaged:=1
} else {
;; reverse all the operations performed above
DllCall("LockWindowUpdate",UInt,hwnd)
WinSet, AlwaysOnTop , Off, ahk_id %ID%
WinSet, Style, +0xC00000, ahk_id %ID%
WinSet, Style, +0x40000 , ahk_id %ID%
WinMove, ahk_id %ID%,, oldX,oldY, oldW,oldH
DllCall("LockWindowUpdate",UInt,0)
fs_engaged:=0
}
WinSet, Redraw,,%ID% ; optimization for Vista
; (not sure how this interacts with the new
; LockWindowUpdate calls...)
return