in Lilypad/Config.cpp [179:214]
void RefreshEnabledDevicesAndDisplay(int updateDeviceList = 0, HWND hWnd = 0, int populate=0) {
RefreshEnabledDevices(updateDeviceList);
if (hWnd) {
HWND hWndList = GetDlgItem(hWnd, IDC_LIST);
ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);
int count = ListView_GetItemCount(hWndList);
LVITEM item;
item.iItem = 0;
item.iSubItem = 0;
item.mask = LVIF_TEXT | LVIF_PARAM;
for (int j=0; j<dm->numDevices; j++) {
if (dm->devices[j]->enabled && dm->devices[j]->api != IGNORE_KEYBOARD) {
item.lParam = j;
item.pszText = dm->devices[j]->displayName;
if (count > 0) {
ListView_SetItem(hWndList, &item);
count --;
}
else {
ListView_InsertItem(hWndList, &item);
}
item.iItem++;
}
}
// This way, won't scroll list to start.
while(count > 0) {
ListView_DeleteItem(hWndList, item.iItem);
count --;
}
}
if (populate) {
for (int i=0; i<8; i++) {
Populate(i&1, i>>1);
}
}
}