hi all,

i'm using EnumWindows to retrieve the handles of all top level windows, then i filter the handles recieved by EnumWindowsProc
cause i just get the handles of the windows that are displayed in the taskbar.... i put them in an array.

the problem is that EnumWindows retrieves the handles in Z order, so the windows i used last come up first...
what i need is to have them in the order they are displayed in the taskbar, any suggestions? :confused:


PD: i thought it was only a matter of sorting my array cause i assumed the first windows created would have lower handles, wrong.
Posted on 2002-02-27 11:31:31 by sombra

hi all,

i'm using EnumWindows to retrieve the handles of all top level windows, then i filter the handles recieved by EnumWindowsProc
cause i just get the handles of the windows that are displayed in the taskbar.... i put them in an array.

the problem is that EnumWindows retrieves the handles in Z order, so the windows i used last come up first...
what i need is to have them in the order they are displayed in the taskbar, any suggestions?


Hi sombra,
perhaps i've a little idea but not sure if it works
try to use GetWindowThreadProcessId() to get the Thread ID which created the window
think the Thread ID r in growing order so the 1st win in the taskbar has a lower Thread ID and so on

See ya
NikDH
Posted on 2002-02-27 12:20:41 by NikDH
You can try to retrieve the taskbar item texts and compare them with the window names, as they should be the same. However it isn't fool proof as multiple windows with the same name can exist.

There's a code snippet to get the taskbar items (winNT/2k only though) at my snippet library:
http://www.madwizard.org/snippets/

Thomas
Posted on 2002-02-27 12:24:58 by Thomas
Thomas, very interesting snippet....

i've been fighting the last few days with ReadProcessMemory but i can get it to work, it must be something really stupid, i?m still learning ;)

I've added the following code to the snippet (just after TCM_GETITEM



invoke ReadProcessMemory, hExplorer, tempItem.pszText, \
addr buffer, SIZEOF buffer, \
addr BytesWritten

invoke MessageBoxA, hTaskBar, addr buffer, addr buffer, MB_OK


ReadProcessMemory returns TRUE, BytesWritten = 256 so it is reading something, however buffer is blank. I'm not really sure what the problem is. :confused:
Posted on 2002-03-05 10:32:05 by sombra
ooops, i forgot, i've also added PROCESS_VM_READ to OpenProcess
Posted on 2002-03-05 10:35:21 by sombra
by the way, is there a way to see the memory owned by another process, i would like to know what the hell ReadProcessMemory is reading however i can see only the memory owned by my process in OllyDbg, same thing for other debuggers.... i'm using Win2K, i haven't been able to find a memory mapper for NT. Any pointers? it should really make this problem easier to debug, as far as i can see with my debugger tempItem.pszText is pointing to the correct memory location.
Posted on 2002-03-05 14:15:18 by sombra