2008-12-19 138 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