🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: EnumWindows etc.

#1797
From: Matthew
Date: Sat, 09 Jun 2007 18:22
44 lines
2307 bytes
Ed Wrote:

>The call to GetWindowThreadProcessIId with a valid window handle
>will always return the process ID so need not be tested for NULL.

Ed, if all I wanted were a list of windows (and not procs)
what would I use/do instead?

I know VERY LITTLE about windows API... I am attempting
to a create a list of (only) running apps, and then have
the ability to select any one of those apps, and maximize,
or minimize it. I don't want to see the procs in my list,
but this code is the only (the one you refer to) example
to go on... So should I use something other than enumproc?


>  ------------------------
>  bool __stdcall EnumProc(HWND hWnd, long)
>  {
>      unsigned long process_id;
>      char buffer[128];
>      const AnsiString tab_str = '\t';
>      AnsiString total_str;
>
>      GetClassName(hWnd, buffer, 95);
>      total_str = buffer;
>
>      GetWindowThreadProcessId(hWnd, &process_id);
>      ultoa(process_id, buffer, 10);
>      total_str = total_str + tab_str + buffer;
>
>      if (GetWindowText(hWnd, buffer, 110)) {
>          total_str = total_str + tab_str + buffer;
>      }
>
>      FormMain->ListBox1->Items->Add(total_str);
>      return true;
>  }
>  ------------------------ 

Excellent - I will test this out as soon as I can.

Thank you for the information and point of view.
Technical Details
Message-ID: <466aefff$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4668d902$1@newsgroups.borland.com> <l2ri63pmm23tsci1u4subhitr6cchmm147@4ax.com> <4669fbaf$1@newsgroups.borland.com> <466aacf2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,859e738ad5fa0eae
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Matthew" <atomkey@yahoo.com>
Sender: "Matthew" <atomkey@yahoo.com>
Reply-To: "Matthew" <atomkey@yahoo.com>
Subject: Re: EnumWindows etc.
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 74.196.1.72     
References: <4668d902$1@newsgroups.borland.com> <l2ri63pmm23tsci1u4subhitr6cchmm147@4ax.com> <4669fbaf$1@newsgroups.borland.com> <466aacf2$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <466aefff$1@newsgroups.borland.com>
Date: 9 Jun 2007 11:22:55 -0700
X-Trace: newsgroups.borland.com 1181413375 207.105.83.66 (9 Jun 2007 11:22:55 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail