I'm trying to change the sorting/not sorting style of listbox in runtime.
However after this trick, items doesn't seem to be sorted. Any ideas?
HWND hListItemsList = GetDlgItem( hDlg, ID_DLG_ITEMLIST );
DWORD style = GetWindowLong(hListItemsList, GWL_STYLE);
style = style|LBS_SORT;
SetWindowLong( hListItemsList, GWL_STYLE, style );
SetWindowPos( hListItemsList, hListItemsList, 10, 10, 10, 10, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE); /// <<< this was supposed to help - FAILED
SendMessage( hListItemsList, LB_RESETCONTENT, 0, MAKELPARAM(10, 0));
for( size_t i=0; i<g_vecScannedItems.size(); ++i )
SendMessage( hListItemsList, LB_ADDSTRING, 0, (LPARAM)g_vecScannedItems[i].c_str() );
} // for