quote:
Originally posted by DJeX
Ahh ok, I see what your saying. But because I want to learn this I still want to get it to work. Just for my own knoledge. Now your saying I should use EnumWindows() and EnumChildWindows() funtions right? Would they work the same as the GetWindow() and GetDesktopWindow()? Like for example:
CurHwnd = GetWindow(CurHwnd, GW_CHILD) < -- Original code.
CurHwnd = EnumWindows (CurHwnd, GW_CHILD) <-- Would that work?
nope... they are completely different. See the code in the Module for an example of EnumChildWindows()...
The enumuration functions use something which is called a "callback function" to work. The functions are called only once, and they in turn will call the function you provided as a parameter (hence the "callback") for each window they find.
For the complete detailed info about these API's (and any other API for that matter) see the
msdn library and search for those API functions.
EnumWindows()
EnumChildWindows()
You should also never use the GetWindow() API for the purpose of enumerating/scrolling thru all the windows (hence the Form code isn't that good). Reasons for this can be read in the msdn library again.