the first problem:
hwnd:=Getwindow(form1.handle,GW_child);  //not GW_HWNDFIRST; see help
hwnd:=getwindow(hwnd,gw_hwndnext);