Reactos

[ACCESS] Improve IDC_RESET_COMBO selection (#5893)

Based on KRosUser's access.patch. CORE-19303

authored by

Katayama Hirofumi MZ and committed by
GitHub
416d6302 0a7a2824

+6 -3
+6 -3
dll/cpl/access/general.c
··· 12 12 #define BAUDTICKS 6 13 13 static UINT nBaudArray[BAUDTICKS] = {300, 1200, 2400, 4800, 9600, 19200}; 14 14 15 + #define FIVE_MINS_IN_MS (5 * 60 * 1000) 15 16 16 17 INT_PTR CALLBACK 17 18 SerialKeysDlgProc(HWND hwndDlg, ··· 177 178 { 178 179 PGLOBAL_DATA pGlobalData; 179 180 LPPSHNOTIFY lppsn; 181 + INT iCurSel; 180 182 181 183 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); 182 184 ··· 194 196 IDC_RESET_BOX, 195 197 pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? BST_CHECKED : BST_UNCHECKED); 196 198 FillResetComboBox(GetDlgItem(hwndDlg, IDC_RESET_COMBO)); 197 - SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_SETCURSEL, 198 - (pGlobalData->accessTimeout.iTimeOutMSec / 300000) - 1, 0); 199 + pGlobalData->accessTimeout.iTimeOutMSec = max(FIVE_MINS_IN_MS, pGlobalData->accessTimeout.iTimeOutMSec); 200 + iCurSel = (pGlobalData->accessTimeout.iTimeOutMSec / FIVE_MINS_IN_MS) - 1; 201 + SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_SETCURSEL, iCurSel, 0); 199 202 EnableWindow(GetDlgItem(hwndDlg, IDC_RESET_COMBO), 200 203 pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? TRUE : FALSE); 201 204 ··· 233 236 { 234 237 INT nSel; 235 238 nSel = SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_GETCURSEL, 0, 0); 236 - pGlobalData->accessTimeout.iTimeOutMSec = (ULONG)((nSel + 1) * 300000); 239 + pGlobalData->accessTimeout.iTimeOutMSec = (DWORD)((nSel + 1) * FIVE_MINS_IN_MS); 237 240 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 238 241 } 239 242 break;