下拉框SetCurSel( 0 );没起作用?MFC

 void SendView::OnInitialUpdate() 
{
    CFormView::OnInitialUpdate();
    m_wndChatUser.SetCurSel( 0 );

    int nSel = m_wndChatUser.GetCurSel( );
    //群发
    CString s;
    s.Format("%d",nSel);
    AfxMessageBox(s);
}

提示框直接是-1,这是为什么?

你的选择框有选择么?为什么写在OnInitialUpdate里面?写在按钮里面看看,点以前,先选择一个

m_wndChatUser 中的内容是否已经初始化
另外,对控件的使用不要太早,一般在窗体的 OnInit 中使用是最早的情况了

首先m_wndChatUser.AddString();
不然组合框内没有东西,默认选择-1