void CConfig::FillDeviceBox(HWND hBox) { CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection(); CLCDDevice *device = NULL; int i = 0; SendMessage(hBox,CB_RESETCONTENT,0,0); while((device = connection->GetAttachedDevice(i++)) != NULL) { SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str()); } if(i == 1) { SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)_T("No device attached")); } int iDevice = CConfig::GetIntSetting(DEVICE); if( iDevice >= i) iDevice = 0; SendMessage(hBox,CB_SETCURSEL ,iDevice,0); }
void CConfig::FillDeviceBox(HWND hBox) { CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection(); SendMessage(hBox,CB_RESETCONTENT,0,0); int count = 0; for (int i = 0; i < 10; i++) { CLCDDevice *device = connection->GetAttachedDevice(i); if (device != NULL) { SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str()); count++; } } if (!count) { SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)TranslateT("No device attached")); } int iDevice = CConfig::GetIntSetting(DEVICE); if (iDevice >= count) iDevice = 0; SendMessage(hBox, CB_SETCURSEL, iDevice, 0); }