Detecting "Hidden" Windows

Windows specific forum
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Detecting "Hidden" Windows

Post 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
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post 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.
VIRTUALYS
User
User
Posts: 44
Joined: Mon Jul 14, 2003 4:06 pm
Location: LA ROCHELLE
Contact:

Post by VIRTUALYS »

see my .EXE Prog... :wink:

http://perso.club-internet.fr/virtualys/FenProc.rar

Enjoy your Hidden Window... :lol:


VIRTUALYS for U 8)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Detecting "Hidden" Windows

Post 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
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply