2008-12-19 88 views

回答

4

尝试GetLBTextLen()函数

下面是一个example from MSDN

// Dump all of the items in the combo box. 
    CString str, str2; 
    int n; 
    for (int i=0;i < pmyComboBox->GetCount();i++) 
    { 
     n = pmyComboBox->GetLBTextLen(i); 
     pmyComboBox->GetLBText(i, str.GetBuffer(n)); 
     str.ReleaseBuffer(); 

     str2.Format(_T("item %d: %s\r\n"), i, str.GetBuffer(0)); 
     afxDump << str2; 
    } 
+0

我杀了你......和MSDN ...良好的答案,但麦克,在一个函数调用的爱情测试..呃。 int count = pmyComboBox-> GetCount(); – baash05 2009-01-06 01:51:46