You can retrieve the hwnds of the controls of the window and then check whether the controls are visible. Here is an example it uses
GridGUI to show the properties of the controls in a GUI.
Code: Select all
#Include <GridGUI>
SetBatchLines, -1
SetWinDelay, 0
; Creating and styling a GUI
myGui := new GridGUI("CSV Viewer", "resize")
myGui.GuiClose := GridGUI.ExitApp
myGui.Color("CED2DD")
myGui.Font("s9 c4D2609", "Helvetica")
LV := new GridGUI.ListviewControl(myGui.hwnd, "AltSubmit -Multi", "Class|Visible|Text")
myGui.AddControl(1, 1, LV, {exW: 1, exH: 1, fillW: true, fillH: true})
myGui.Show("w200 h700")
DllCall("RegisterShellHookWindow", "UInt", myGui.hwnd)
MsgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK")
OnMessage(MsgNum, Func("ShellMessage").Bind(myGui, LV))
return
UpdateCtrlList(LV, hwnd) {
LV.Redraw(0)
LV.Delete()
rows := []
for i, ctrl in GetControlsOfWin(hwnd) {
rows.Push([GetClassOfControl(ctrl), GetVisibilityOfControl(ctrl), GetTextOfControl(ctrl)])
}
LV.AddArray(rows)
LV.Redraw(1)
LV.ModifyCol()
}
ShellMessage(gui, LV, nCode, wParam, lParam) {
static HSHELL_WINDOWCREATED := 1,
HSHELL_WINDOWACTIVATED := 32772 ; 4
;ToolTip, % nCode "`n" wParam "`n" lParam
if(nCode = HSHELL_WINDOWACTIVATED) {
if(gui.hwnd != wParam) {
UpdateCtrlList(LV, wParam)
}
}
}
GetVisibilityOfControl(hwnd) {
ControlGet, visibility, Visible, , , % "ahk_id " hwnd
return visibility
}
GetClassOfControl(hwnd) {
VarSetCapacity(name, 100)
size := DllCall("GetClassName", "Ptr", hwnd, "Str", name, "UInt", 100)
return name
}
GetTextOfControl(hwnd) {
ControlGetText, text, , % "ahk_id " hwnd
return text
}
GetControlsOfWin(hwnd) {
WinGet, ctrls, ControlListHwnd, % "ahk_id " hwnd
return StrSplit(ctrls, "`n")
}
Please excuse my spelling I am dyslexic.