like in title described i have this problem!
That because, if i click in my CListCtrl i try to find what is the text in this cell!
I do it now like this:
// in this way i don't receive my text:
LPNMLISTVIEW lpItem = (LPNMLISTVIEW)pNMHDR;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = lpItem->iItem;
lvItem.iSubItem = lpItem->iSubItem;
// but lvItem.pszText is empty, or not readable content :(// this works(but why not the sample above with LVITEM?):
csIndex = m_cListAll.GetItemText(lpItem->iItem, 0);
csItemText= m_cListAll.GetItemText(lpItem->iItem, 1);
Why not use the code that works? If you're using MFC, let MFC do the work.
You can also trace into the working code and see how it differs from your code.
Back to your broken code...
The docs for LVM_GETITEM state:
"If the LVIF_TEXT flag is set in the mask member of the LVITEM structure,
the pszText member must point to a valid buffer and the cchTextMax member
must be set to the number of characters in that buffer. Applications should
not assume that the text will necessarily be placed in the specified buffer.
The control may instead change the pszText member of the structure to point
to the new text rather than place it in the buffer."
I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly.
I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling.
However when i check if Data01 available, GetProfileString creates that entry for me , if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
path = GetProfileString(category,_T("InitPath"));
How should i check if an entry there using GetProfileString or how can i do it?