Listing 4

// Keep running as long as there's still a top window 
// on the screen (in case we have multiple frames)
while ( wnd<> top = try_top_wnd() )
    if ( top->wait() == wait_for::quit) break; 
// on top of another framework
if ( wnd<dialog> w = try_find_by_hwnd<dialog>(m_hWnd))
    w->child(IDOK)->enable(false); // disable "Ok" button
// set the title of all frames to "My Frame"
int idx = 0;
while ( wnd<> w = try_top_wnd<frame>(idx++))
    w->text( "My Frame");
// set the font of all dialogs to Tahoma
HFONT tahoma = ...;
int idx = 0;
while ( wnd<> w = try_top_wnd<dialog>(idx++))
    w->send_msg(WM_SETFONT, tahoma);