Well there's how to use a ListView
****Fixed. Solved with the following code, i was right about the focus****
Sorry, that works the same as before. It reselects the item fine except for the the fact that there are none of those dots surrounding the item saying the ListView is in focus. I think this may be the problem as if the LV refreshes when the dots are surrounding the selected item, it stays selected. Another weird thing, upon using the arrow keys to go up or down, after the LV has been refreshed, the selection jups to the top of the list (even if the selected item was 1/2 way down). I think it maybe some focus problem in the way it is selecting the item (as such I beleive the mistake lies here:
Code:
LVITEM LVI;
LVI.mask = LVIF_STATE;
LVI.iItem = lResult;
LVI.iSubItem = 0;
LVI.state = LVIS_SELECTED | LVIS_FOCUSED;
LVI.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
SendMessage(GetDlgItem(hwndMain, 3001), LVM_SETITEM,0, (LPARAM) &LVI);
I have tried applying the LVS_SHOWSELALWAYS style to the LV and that still doesn't fix the problem.