🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3239

Re: Is checking a window's dwStyle-value ' WS_VISIBLE' not sufficent to find out, if a window is currently visible on the screen...

#3239
From: MR
Date: Mon, 07 Aug 2006 10:27
42 lines
2678 bytes
>> Where does this Myapp-window comes from.
>
>VCL applications all have a hidden TApplication window. In
>addition, if you're running it from within the IDE, that can
>also be an issue depending on how you're searching for windows
>because there will be a copy of the main form in the IDE.
>However, it's impossible to determine what the problem is with
>the code that you posted. You need to post a more complete
>sample.

Ok, here a little compressed sample-program:

void __fastcall TForm1::FormShow(TObject *Sender)
{
  for(HWND hwnd=GetTopWindow(NULL); hwnd!=NULL;
hwnd=GetNextWindow(hwnd, GW_HWNDNEXT)) {
    char title[100];
    GetWindowText(hwnd, title, sizeof(title));
    if(strcmp(title, "Myapp")==0) {
      bool is_visible=IsWindowVisible(hwnd);
      assert(!is_visible); // !!! assertion failure
    }
  }
}

My app is called MyApp and it just runs through all the windows and if
it gets to the application window 'Myapp' (with exactly this name) it
checks for this window to be visible or not. Strangely windows says it
is visible, even if it is hidden (as you said) . So the assertion
fails.

The main question is: How can I find out for any HWND-window value, if
this window is really visible (i.e. not hidden) or not. The example
shows that checking for IsWindowVisible() is obviously not sufficent.

If it would concern only the main-window of my current application the
hack (with the 'bad' goto) would be sufficent, but there might run
other applications with such a hidden window. 

Thanks,

Michael
Technical Details
Message-ID: <5m4ed2tqvtmb1eh9nk6n4s4i4rfju6cjb7@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <b91bd2dnjukqfkdkpgtnths0nbltohne89@4ax.com> <2rqbd296n1l0j9o06hftg57cc5ss1dfcki@4ax.com> <omubd2lb4r1nitgalofa70s43i75iubd3v@4ax.com> <fqndd2p35upa7ajicoe59mnos65v8erlqu@4ax.com> <44d70a0d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a9182ef18c390728
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: <MR>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Is checking a window's dwStyle-value ' WS_VISIBLE' not sufficent to find out, if a window is currently visible on the screen?
Date: Mon, 07 Aug 2006 12:27:19 +0200
Message-ID: <5m4ed2tqvtmb1eh9nk6n4s4i4rfju6cjb7@4ax.com>
References: <b91bd2dnjukqfkdkpgtnths0nbltohne89@4ax.com> <2rqbd296n1l0j9o06hftg57cc5ss1dfcki@4ax.com> <omubd2lb4r1nitgalofa70s43i75iubd3v@4ax.com> <fqndd2p35upa7ajicoe59mnos65v8erlqu@4ax.com> <44d70a0d$1@newsgroups.borland.com>
X-Newsreader: Forte Free Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 84.57.25.146
X-Trace: newsgroups.borland.com 1154946412 84.57.25.146 (7 Aug 2006 03:26:52 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail