These days write a program, use ListCtrl, found when writing a long string, can only write a little less (like 128), so you simply overloaded ListCtrl, and overloaded the function setTextBool CMYListCtrl: : SetitemText (int Nitem, Int nSubitem, LPCTSTR LPSZTEXT) / / {
ASSERT (:: IsWindow (m_hWnd)); ASSERT ((GetStyle () & LVS_OWNERDATA) == 0); LVITEM lvi; lvi.iSubItem = nSubItem; lvi.pszText = (LPTSTR) lpszText; :: SendMessage (m_hWnd, LVM_SETITEMTEXT, NITEM, (LPARAM) & lvi;
Return (Bool) :: SendMessage (M_HWnd, LVM_SETITETEXT, NITEM, (LPARAM) & lvi);} It turned out that it was lvi. cchtextmax; the length was too small, so it was deliberately set, but it was not used. Because, read from listCtrl The text is still not written. Suddenly thinking, is there a problem when I get the text, then open GetItemText, really. The default length actually only 128 overloads, Fun: CString CMylistCtrl :: GetItemText (int NITEM , int nsubitem) {assert (:: iswindow (m_hwnd)); lvitem lvi; Memset (& lvi, 0, sizeof (lvitem)); lvi.isubitem = nsubitem; cstract str; int Nlen = 640; // Reserved Default is 128, change here to 640 int nres; do {nlen * = 2; lvi.cchtextmax = Nlen; lvi.psztext = str.getBuffersetLength (Nlen); nres = (int): sendMessage (m_hwnd, lvm_getitemtext, WPARAM) NITEM, (LPARAM) & lvi);} while (nres == nlen-1); str.releasebuffer (); return str;}