I'm trying to manually select a row in my listview using ListView_SetSelectionMark but nothing is happening. My code constantly updates the listview from a process queue, and to do this I simply delete all items and repopulate. Problem is, it appears that the selection value for the listview is staying, but the row doesn't highlight. Is there another function I need to call to actually highlight? Here is the relevant code:
Code:
int iIndex;
iIndex=ListView_GetSelectionMark(hListView);
ListView_DeleteAllItems(hListView);
for (int i=0; i<processesQueue.size(); i++)
{
lv.iItem=i;
ListView_InsertItem(hListView, &lv);
ListView_SetItemText(hListView, i, 0, processesQueue[i].status);
ListView_SetItemText(hListView, i, 1, processesQueue[i].processName);
ListView_SetItemText(hListView, i, 2, processesQueue[i].IMName);
ListView_SetItemText(hListView, i, 3, processesQueue[i].startTime);
ListView_SetItemText(hListView, i, 4, processesQueue[i].endTime);
}
ListView_SetSelectionMark(hListView, iIndex);
Along the same lines, I want the user to be able to delete an item by pressing the delete key. Problem is, when the user clicks somewhere in the listview my main window loses focus and isn't able to trap the VK_DELETE message. Whats an easy way around this or do I have to declare a process for the listview child window?