counter = 0; while (counter <= 18) { child = GetWindow(window,GW_CHILD); if (IsChild(window,child)) { GetWindow(child,GW_HWNDNEXT); } counter++; } HDC hdc = GetDC(child); wsprintf(data,"%d",(INT)child); return 3; }