static BOOL ctl_dcombo_start( ctl_elt *elt, WPI_INST inst, HWND dlg, void *ptr, BOOL ___b ) /******************************************************************/ /* start a dynamic combo list box */ { char *str; int i; int value; inst = inst; value = _value_int( ptr, elt ) - elt->info.dcombo.origin; for( i = 0;; ++i ) { str = (elt->info.dcombo.fetch)( i ); if( str == NULL ) { break; } SendDlgItemMessage( dlg, elt->control, ctl_combo_add_msg( dlg, elt->control ), 0, (DWORD)(LPSTR) str ); } if( value >= i ) { value = i - 1; } SendDlgItemMessage( dlg, elt->control, ctl_combo_sel_msg( dlg, elt->control ), value, 0 ); return( TRUE ); }
static bool ctl_combo_start( ctl_elt *elt, WPI_INST inst, HWND dlg, void *ptr, bool ___b ) /*****************************************************************/ /* start a combo list box */ { char value[50]; WORD id; int choose; int max; ___b=___b; choose = _value_int( ptr, elt ) - elt->info.combo.origin; if( choose < 0 ) { choose = 0; } else { max = elt->info.combo.end_id - elt->info.combo.start_id; if( choose > max ) { choose = max; } } SendDlgItemMessage( dlg, elt->control, ctl_combo_clr_msg( dlg, elt->control ), 0, 0L ); for( id = elt->info.combo.start_id; id <= elt->info.combo.end_id; ++id ) { LoadString( inst, id, value, sizeof( value ) ); value[49] = '\0'; SendDlgItemMessage( dlg, elt->control, ctl_combo_add_msg( dlg, elt->control ), 0, (LPARAM)value ); } SendDlgItemMessage( dlg, elt->control, ctl_combo_sel_msg( dlg, elt->control ), choose, 0 ); return( true ); }