This is the part of my code causing the mistake:
LVITEM item = { LVIF_PARAM };
m_trackList.GetSelectedItem(&item);
I want to get the pszText of the item, but I constantly get a NULL value after GetSelectedItem is being performed
This part of the code is called, when I doubleclick an item in my CListViewCtrl. It clearly has a text, and when I set a breakpoint at the part where the entry is being created, the LVITEM there clearly has a valid pszText as well. This is the part where it is being created:
std::wstring displayWString = m_tracksVectorIterator->GetDisplayName(); /*this returns a valid std::wstring */
std::string displayString(displayWString.begin(), displayWString.end());
LVITEM lv;
lv.mask = LVIF_TEXT;
lv.iItem = 0;
lv.iSubItem = 0;
lv.pszText = const_cast<char *>(displayString.c_str());
//When I set a breakpoint here, the LVITEM contains correct values
SendMessage(m_trackList, LVM_INSERTITEM, 0, (LPARAM)&lv);
Please feel free to tell me if there is any additional information needed. I don't really know what the problem could be, so I am not sure what I would have to include as well. I feel like the rest of my code is not really relevant to this behaviour.
Thanks in advance.