Question: How can I know exactly how many windows are open?
Answer: You can use EnumWindows and EnumChildWindows to do this. The
following code sample will illistrate how to do this.
* BOOL EnumWindows(
* WNDENUMPROC lpEnumFunc, // pointer to callback function
* LPARAM lParam // application-defined value
* );
*
* ->Parameters
*
* -->lpEnumFunc
* Points to an application-defined callback function. For more information,
* see the EnumWindowsProc callback function.
*
* -->lParam
* Specifies a 32-bit, application-defined value to be passed to the callback
* function.
*
* BOOL EnumChildWindows(
* HWND hWndParent, // handle to parent window
* WNDENUMPROC lpEnumFunc, // pointer to callback function
* LPARAM lParam // application-defined value
* );
*
* ->Parameters
*
* -->hWndParent
* Identifies the parent window whose child windows are to be enumerated.
*
* -->lpEnumFunc
* Points to an application-defined callback function. For more information
* about the callback function, see the EnumChildProc callback function.
*
* -->lParam
* Specifies a 32-bit, application-defined value to be passed to the callback
* function.
*******************************************************************************/