Listing 6

// sample_dlg.h -- saves the Name & Description
struct sample_dlg : wnd_extend<dialog,sample_dlg> {
    static int dialog_id();
    std::string name, desc;
};
// sample_dlg.cpp
struct sample_handler : event_handler<sample_handler,dialog,sample_dlg> {
  handle_event on_ok() {
    window()->name = child(ID_name)->text();
    window()->desc = child(ID_description)->text();
    return command<IDOK>().HANDLED_BY(&me::on_ok);
  }
};
int sample_dlg::dialog_id() { return IDD_sample; }
// code
modal_dlg<sample_dlg> d = create_modal_dlg<sample_dlg>(some_wnd);
if ( d.result == ok_pushed)
   // use d.dlg.name and d.dlg.desc