Duplicate entries in drop down box



I have several predefined values in the properties dialog of a drop
down CComboBox which get duplicated at run time.

I tracked the number of elements in the drop down box via
CComboBox.GetCount() and discovered that when my program creates a
thread, which receives a pointer to the dialog, the number of elements
in the drop down box doubles when I cast the dialog:

void Thread(void *lpParam)
{

CInstrumentStatusDlg * pIS = (CInstrumentStatusDlg *)lpParam;

then pIS->dropBox.GetCount() returns 2x the number of required
elements


I'm guessing that when I call (CInstrumentStatusDlg*), it repopulates
the values in the drop down box... which is strange, I'd suppose MFC
would not allow that to happen. How do I prevent this from happening?
Singleton implementation? Manual addition of values to the drop down
box? Something else?

.



Relevant Pages

  • RE: CComboBox weirdness...
    ... The issue at hand is a timing issue with MFC. ... CComboBox is that the CBN_SELCHANGE gets called before the SetWindowText is ... SetWindowText before the CBN_SELCHANGE handler is called. ... > 2) Add the following code to the OnInitDialog(): ...
    (microsoft.public.vc.mfc)
  • Re: Duplicate entries in drop down box
    ... down CComboBox which get duplicated at run time. ... MFC does not care one way or the other. ... Most likely the control is already populated. ...
    (microsoft.public.vc.mfc)

Loading