Whenever you want to "list" something, look for an API starting with
"Enum"; looking at the help system would have immediately enabled you to
find "EnumTaskWindows" and "EnumThreadWindows".
Chris
----------------------------------------------------------------
Chris Marriott, Microsoft Certified Solution Developer.
SkyMap Software, U.K. e-mail: ch...@skymap.com
Visit our web site at http://www.skymap.com
Vivek Kr. Pai wrote:
>
> > Thanks for your advice, Chris. The problem with EnumThreadWindows and
> > EnumThreadWndProc is that my app never goes into the callback proc. Why
> > would that be?
>
> How do you get the thread id that you pass to the EnumThreadWindows()?
> Please give more information/code snippet.
>
> Vivek
Since there is no 1 to 1 correspondance between processes/
threads and HWNDs, I would strongly suspect that this is
not possible. A given process can own no windows or multiple
windows. There may, I suppose, be some way of enumerating
HWNDs owned by a given process but I have not come across
it.
/---------------------------------------------------------\
| Dave Wilson, Rockwell Semiconductor Systems, Austin, TX |
| |
| Owner of "The Almost Definitive FOURCC Definition List" |
| at http://www.flash.net/~dawilson/fourcc |
\---------------------------------------------------------/
Tue, 05 Aug 1997 13:56 EDT
Jim O'Brien, R&D, PTT, Inc.
wiz...@ptti.com +1 (212) 972-1702
JO> In article <33E5E4...@brooktree.com>, Dave Wilson wrote:
>> There may, I suppose, be some way of enumerating HWNDs owned by a
>> given process but I have not come across it.
>>
JO> You can go about it the other way around...use /EnumWindows/ and
JO> then do a /GetWindowLong/ on each handle to get the owner
JO> application's instance handle (/GWL_HINSTANCE/)
Instance handles are no longer unique under Win32. They simly are
the address the exe and/or dll is mapped to in the local address
space.
You can use GetWindowThreadProcessId.
--
"Well, art is art, isn't it? Still, on the other hand, water is water! And
east is east and west is west and if you take cranberries and stew them
like applesauce they taste much more like prunes than rhubarb does."
Captain Jeffrey Spaulding
Eddie McCreary mailto:fo...@neosoft.com http://www.neosoft.com/~forge
>Ora J. Williamson wrote:
>>
>> What API calls will give me a window handle (HWND) from a process id or
>> thread id?
>
>Since there is no 1 to 1 correspondance between processes/
>threads and HWNDs, I would strongly suspect that this is
>not possible.
It is possible, but you have to go the other way round: Use
"EnumDesktopWindows" to get all windows and then call
"GetWindowThreadProcessID" for each handle you retrieve and compare
those values to the process id AND thread id you have.
This approach is working fine for 32bit apps, but not for 16bit apps.
Greets
Mirko Holzer
Under WinNT, use performance data stored in registry to get threads and
processes. For more info, e-mail me.
-- David
--
David Ching, Windows Consultant
DC Software Design
http://www.dcsoft.com