Get a tool, such as Microsoft Spy++, or WinSpy++ from Catch22.net.
Help you find all child windows, and display them in a tree ctrl.
So you can catch the exact child window, instead of enumerates all child windows.
You don't need the while loop.
George Zou