Re: MFC control keyhole

"White Wolf" <[email protected]> Wed, 24 Sep 2003 21:03:21 +0300
Newsgroups gmane.comp.programming.keyholes
Message-ID <216001c382c6$24460550$568dba50@Evo>
Balog Pal wrote:
>> How could I delete some or all the items from MFC combobox?
>
>
> while (pmyComboBox->GetCount()) pmyComboBox->DeleteString(0);
>
> For some weird reason a combobox doesn't have a builtin ResetContents
> or DeleteAll handler, so you must do it by hand. Guess some historic
> reasons in Windows 1.0 :)

How about CComboBox::ResetContent?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_ccombobox.asp

In short:
http://tinyurl.com/oj38

>> All that looks simple but at the same time resembles well known
>> STL algorithms vs. cycles dilemma  (Meyers "Effective STL").
>
> Khm, hope everyone working with MFC or win API has his own set of
> extension functions and call those.  (peeking my mfcx_bp.h:)
>
> inline void EmptyCombo(CComboBox& box)
> {
>  while(CB_ERR != box.DeleteString(0))
>   ;
> }
>
> The user side just sees EmptyCombo called everywhere  (too bad we
> have no interchangeable syntax in c++ to be called as
> box.EmptyCombo() but that's another story

You mean you cannot inherit?

White Wolf