Page 1 of 1
Detecting "Hidden" Windows
Posted: Tue Apr 27, 2004 2:51 pm
by Karbon
I'm using this code to detect if a window is open but it detects it even if the window is "hidden".. Expected behavior for the code below I'm sure as the window does exist.. Is there any way to tell if the window is visible too?
Code: Select all
Procedure FindPartWin(part$)
r=GetWindow_(GetDesktopWindow_(),#GW_CHILD)
Repeat
t$=Space(999) : GetWindowText_(r,t$,999)
If FindString(t$,part$,1)<>0
w=r
Else
r=GetWindow_(r,#GW_HWNDNEXT)
EndIf
Until r=0 Or w<>0
ProcedureReturn w
EndProcedure
Posted: Tue Apr 27, 2004 3:20 pm
by dmoc
Maybe this helps: IsWindowVisible_(hwnd.l)
From API-Guide...
If the specified window and its parent window have the WS_VISIBLE style, the return value is nonzero.
If the specified window and its parent window do not have the WS_VISIBLE style, the return value is zero. Because the return value specifies whether the window has the WS_VISIBLE style, it may be nonzero even if the window is totally obscured by other windows.
Posted: Wed Apr 28, 2004 12:04 am
by VIRTUALYS
see my .EXE Prog...
http://perso.club-internet.fr/virtualys/FenProc.rar
Enjoy your Hidden Window...
VIRTUALYS for U

Re: Detecting "Hidden" Windows
Posted: Wed Apr 28, 2004 1:45 am
by PB
Hi Karbon, that tip was mine, so this amended version should do the trick:
Code: Select all
Procedure FindPartWin(part$)
r=GetWindow_(GetDesktopWindow_(),#GW_CHILD)
Repeat
t$=Space(999) : GetWindowText_(r,t$,999)
If FindString(t$,part$,1)<>0 And IsWindowVisible_(r)=#TRUE
w=r
Else
r=GetWindow_(r,#GW_HWNDNEXT)
EndIf
Until r=0 Or w<>0
ProcedureReturn w
EndProcedure
Posted: Wed Apr 28, 2004 1:50 am
by Karbon
Right on guys, thanks a bundle!
I need to grab that api guide again, I just did a reinstall and forgot to back it up!