Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
1.9 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #define STRING_BUFFER_SIZE 80
  4. void InitReminderComboBox(HWND hDlg, HWND combo)
  5. {
  6. for(int i = 0; i < TIMEOUT_INX_COUNT; i++)
  7. {
  8. TCHAR buffer[STRING_BUFFER_SIZE];
  9. if (0 == LoadString(ghInstance, ReminderTimes[i].stringResId, buffer, STRING_BUFFER_SIZE))
  10. {
  11. DEBUGMSG("WUAUCLT String resource %d not found", ReminderTimes[i].stringResId);
  12. QUITAUClient();
  13. return;
  14. }
  15. LRESULT lr = SendMessage(combo, CB_INSERTSTRING, i, (LPARAM)buffer);
  16. if (CB_ERR == lr)
  17. {
  18. DEBUGMSG("REMINDER: fail to insert string to combobox %S", buffer);
  19. }
  20. }
  21. SendMessage(combo, CB_SETCURSEL, 0, 0);
  22. }
  23. BOOL CALLBACK ReminderDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM /*lParam*/)
  24. {
  25. //fixcode: no need static
  26. static HWND combo;
  27. static HWND oldCurrentDlg;
  28. switch(message)
  29. {
  30. case WM_INITDIALOG:
  31. oldCurrentDlg = ghCurrentDialog;
  32. ghCurrentDialog = hWnd;
  33. gTopWins.Add(hWnd);
  34. combo = GetDlgItem(hWnd, IDC_REMINDTIME);
  35. InitReminderComboBox(hWnd, combo);
  36. SetFocus(combo);
  37. return TRUE;
  38. case WM_COMMAND:
  39. switch(LOWORD(wParam))
  40. {
  41. case IDC_OK:
  42. {
  43. #ifdef TESTUI
  44. EndDialog(hWnd, S_OK);
  45. return 0;
  46. #else
  47. UINT index = (LONG)SendMessage(combo, CB_GETCURSEL, 0, 0);
  48. gInternals->m_setReminderTimeout(index);
  49. EndDialog(hWnd, S_OK);
  50. QUITAUClient(); //Stop the client's execution when user sets remind me later
  51. return 0;
  52. #endif
  53. }
  54. case IDCANCEL:
  55. case IDC_CANCEL:
  56. {
  57. EndDialog(hWnd, S_FALSE);
  58. return 0;
  59. }
  60. default:
  61. break;
  62. }
  63. break;
  64. /*
  65. case WM_CLOSE:
  66. {
  67. UINT index = SendMessage(combo, CB_GETCURSEL, 0, 0);
  68. setReminderTime(index);
  69. EndDialog(hWnd, S_FALSE);
  70. return TRUE;
  71. }
  72. */
  73. case WM_DESTROY:
  74. ghCurrentDialog = oldCurrentDlg;
  75. gTopWins.Remove(hWnd);
  76. return 0;
  77. default:
  78. break;
  79. }
  80. return FALSE;
  81. }