CListBox::create problem - Programmer

This is a discussion on CListBox::create problem - Programmer ; Hello, My application crashes when calling this method in OnInitDialog() . Could you tell me what is the problem? Here what i do: BOOL CPCM_ViewDlg::OnInitDialog() { [generated code...] // TODO: Add extra initialization here m_DeviceList.Create ( WS_VISIBLE | LBS_NOINTEGRALHEIGHT | ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: CListBox::create problem

  1. CListBox::create problem

    Hello,

    My application crashes when calling this method in OnInitDialog() . Could
    you tell me what is the problem?
    Here what i do:

    BOOL CPCM_ViewDlg::OnInitDialog()
    {
    [generated code...]

    // TODO: Add extra initialization here
    m_DeviceList.Create
    ( WS_VISIBLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
    WS_TABSTOP,
    CRect(7,10,241,168),
    this,
    IDC_LIST1
    );
    }

    m_DeviceList is a member of CPCM_ViewDlg.

    Thanking you in advance



  2. Re: CListBox::create problem

    Are you calling it after the call to base class CDialog::OnInitDialog(); ?

    It should be something like

    BOOL YourDialog::OnInitDialog()
    {
    CDialog::OnInitDialog();

    m_DeviceList.Create
    ( WS_VISIBLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
    WS_TABSTOP,
    CRect(7,10,241,168),
    this,
    IDC_LIST1
    );

    return TRUE;
    }

    --
    Cheers
    Check Abdoul [VC++ MVP]
    -----------------------------------

    "MilkyWay" wrote in message
    news:bpgj5r$e6i$1@dns3.cae.ca...
    > Hello,
    >
    > My application crashes when calling this method in OnInitDialog() . Could
    > you tell me what is the problem?
    > Here what i do:
    >
    > BOOL CPCM_ViewDlg::OnInitDialog()
    > {
    > [generated code...]
    >
    > // TODO: Add extra initialization here
    > m_DeviceList.Create
    > ( WS_VISIBLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
    > WS_TABSTOP,
    > CRect(7,10,241,168),
    > this,
    > IDC_LIST1
    > );
    > }
    >
    > m_DeviceList is a member of CPCM_ViewDlg.
    >
    > Thanking you in advance
    >
    >




  3. Re: CListBox::create problem

    I've just found that i don't need to call "Create" in my application before
    using other methods of CListBox like AddString.

    Thank you anyway.


    "MilkyWay" wrote in message
    news:bpgj5r$e6i$1@dns3.cae.ca...
    > Hello,
    >
    > My application crashes when calling this method in OnInitDialog() . Could
    > you tell me what is the problem?
    > Here what i do:
    >
    > BOOL CPCM_ViewDlg::OnInitDialog()
    > {
    > [generated code...]
    >
    > // TODO: Add extra initialization here
    > m_DeviceList.Create
    > ( WS_VISIBLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
    > WS_TABSTOP,
    > CRect(7,10,241,168),
    > this,
    > IDC_LIST1
    > );
    > }
    >
    > m_DeviceList is a member of CPCM_ViewDlg.
    >
    > Thanking you in advance
    >
    >




+ Reply to Thread