not that i know much of any language, other than vb.. but wouldn't this still work:

Code:

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;

}


the while loop looks like it will still work and looks cleaner to me