my $starthwnd = $GetDesktopWindow->Call(); # get desktop window, all other windows are childs of this one my $hwnd = $GetWindow->Call( $starthwnd, 5 ); # get first child window while ($hwnd) { my $is_visible = $IsWindowVisible( $hwnd ); print "$hwnd ", ( $is_visible ? 'is' : 'is not' ), " visible\n"; $hwnd = $GetWindow->Call( $hwnd, 2 ); # get next window } # while