🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Enumerating windows like ALT+TAB

#1239
From: Patryk B.
Date: Tue, 16 Oct 2007 13:37
35 lines
1854 bytes
Im trying to enumerate windows that show when press alt+tab.
I have code:

void __fastcall TForm6::Button1Click(TObject *Sender)
{
   ListView1->Items->Clear();
   EnumDesktopWindows(NULL,(WNDENUMPROC)EnumWindowsProc,(LPARAM)ListView1);
}
//---------------------------------------------------------------------------
bool CALLBACK EnumWindowsProc(HWND hWnd, TListView *ListView)
{
   char WindowName[80], ClassName[80];

   GetWindowText(hWnd, WindowName, 80);
   if(IsWindowVisible(hWnd) && AnsiString(WindowName).Length()!=0)
   {
      ListView->Items->Add();
      int i=ListView->Items->Count-1;
      ListView->Items->Item[i]->Caption=AnsiString(WindowName);
      ListView->Items->Item[i]->Update();
   }
   return true;
}

But it show more window than alt+tab, and it will not work for all windows  
i think.
Anyone know how to do it?

Thanks,

Patryk.
Technical Details
Message-ID: <op.t0algg2iwzezly@dune.intranet>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ce29f3644d77d8f6,start
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 16 Oct 2007 15:37:18 +0200
Subject: Enumerating windows like ALT+TAB
Reply-To: pbobak@no.spam.o2.pl
From: "Patryk B." <pbobak@no.spam.o2.pl>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Content-Transfer-Encoding: Quoted-Printable
Message-ID: <op.t0algg2iwzezly@dune.intranet>
User-Agent: Opera Mail/9.23 (Win32)
NNTP-Posting-Host: 195.116.247.227
X-Trace: newsgroups.borland.com 1192541844 195.116.247.227 (16 Oct 2007 06:37:24 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail