| 198 | } |
| 199 | |
| 200 | void CMoreSettingsPropertyPage::OnBnClickedApply() |
| 201 | { |
| 202 | int nIdx = m_ctrlComboBox.GetCurSel(); |
| 203 | if (nIdx != CB_ERR) |
| 204 | { |
| 205 | WORD selectedLangID = (WORD)m_ctrlComboBox.GetItemData(nIdx); |
| 206 | |
| 207 | // Read what is currently stored in the registry (last save) |
| 208 | // If it is 0 (first launch), compare it with the current thread language |
| 209 | WORD lastSavedID = theApp.LoadLanguageFromRegistry(); |
| 210 | if (lastSavedID == 0) lastSavedID = (WORD)GetThreadUILanguage(); |
| 211 | |
| 212 | // Compare the new selection with the last saved selection in the registry |
| 213 | if (selectedLangID != lastSavedID) |
| 214 | { |
| 215 | theApp.SaveLanguageToRegistry(selectedLangID); |
| 216 | |
| 217 | // The message will always appear when the value in the registry changes |
| 218 | AfxMessageBox(LocUtils::GetStringFromResources(IDS_APLLY_LANGUAGE_RESTART).c_str(), MB_OK | MB_ICONINFORMATION); |
| 219 | } |
| 220 | |
| 221 | // In any case, we turn off the button (since the selection in the list is synchronous with the registry) |
| 222 | if (GetDlgItem(IDC_APPLY)) GetDlgItem(IDC_APPLY)->EnableWindow(FALSE); |
| 223 | } |
| 224 | } |
nothing calls this directly
no test coverage detected