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.

172 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. general.c
  5. Abstract:
  6. Functions for handling events in the "General" tab of
  7. the fax server configuration property sheet
  8. Environment:
  9. Fax configuration applet
  10. Revision History:
  11. 10/29/96 -wesw-
  12. Created it.
  13. mm/dd/yy -author-
  14. description
  15. --*/
  16. #include "faxcpl.h"
  17. VOID
  18. EnumMapiProfiles(
  19. HWND hwnd
  20. );
  21. BOOL
  22. GeneralProc(
  23. HWND hDlg,
  24. UINT message,
  25. UINT wParam,
  26. LONG lParam
  27. )
  28. /*++
  29. Routine Description:
  30. Procedure for handling the "General" tab
  31. Arguments:
  32. hDlg - Identifies the property sheet page
  33. message - Specifies the message
  34. wParam - Specifies additional message-specific information
  35. lParam - Specifies additional message-specific information
  36. Return Value:
  37. Depends on the value of message parameter
  38. --*/
  39. {
  40. static HWND hwndProfileList;
  41. switch (message) {
  42. case WM_INITDIALOG:
  43. GetFaxDeviceAndConfigInfo();
  44. GetMapiProfiles();
  45. if (gConfigData->pMapiProfiles) {
  46. hwndProfileList = GetDlgItem(hDlg,IDC_DEST_PROFILENAME);
  47. EnumMapiProfiles(hwndProfileList);
  48. }
  49. if (gConfigData->pFaxConfig && gConfigData->pFaxConfig->InboundProfile) {
  50. if (SendMessage(hwndProfileList,
  51. CB_SELECTSTRING,
  52. (WPARAM) -1,
  53. (LPARAM) gConfigData->pFaxConfig->InboundProfile) == CB_ERR)
  54. {
  55. SendMessage(hwndProfileList, CB_SETCURSEL, 0, 0);
  56. }
  57. CheckDlgButton( hDlg, IDC_ALLOW_EMAIL, BST_CHECKED );
  58. } else {
  59. SendMessage(hwndProfileList, CB_SETCURSEL, 0, 0);
  60. CheckDlgButton( hDlg, IDC_ALLOW_EMAIL, BST_UNCHECKED );
  61. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME_STATIC ), FALSE );
  62. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME ), FALSE );
  63. }
  64. return TRUE;
  65. case WM_COMMAND:
  66. if (HIWORD(wParam) == CBN_SELCHANGE && lParam == (LPARAM)hwndProfileList) {
  67. SetChangedFlag(hDlg, GENERAL_PAGE, TRUE);
  68. }
  69. if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ALLOW_EMAIL) {
  70. if (IsDlgButtonChecked( hDlg, IDC_ALLOW_EMAIL )) {
  71. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME_STATIC ), TRUE );
  72. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME ), TRUE );
  73. } else {
  74. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME_STATIC ), FALSE );
  75. EnableWindow( GetDlgItem( hDlg, IDC_DEST_PROFILENAME ), FALSE );
  76. }
  77. SetChangedFlag(hDlg, GENERAL_PAGE, TRUE);
  78. }
  79. return TRUE;
  80. case WM_NOTIFY:
  81. if (((LPNMHDR) lParam)->code == PSN_APPLY && GetChangedFlag(GENERAL_PAGE)) {
  82. LPTSTR pInboundProfile;
  83. BOOL success = FALSE;
  84. INT index;
  85. TCHAR buffer[MAX_STRING_LEN];
  86. if ((index = SendMessage(hwndProfileList, CB_GETCURSEL, 0, 0)) != CB_ERR) {
  87. if (IsDlgButtonChecked( hDlg, IDC_ALLOW_EMAIL )) {
  88. SendMessage(hwndProfileList, CB_GETLBTEXT, index, (LPARAM) buffer);
  89. } else {
  90. buffer[0] = 0;
  91. }
  92. pInboundProfile = gConfigData->pFaxConfig->InboundProfile;
  93. gConfigData->pFaxConfig->InboundProfile = buffer;
  94. success = SaveFaxDeviceAndConfigInfo(hDlg, GENERAL_PAGE);
  95. gConfigData->pFaxConfig->InboundProfile = pInboundProfile;
  96. }
  97. if (success) {
  98. SetChangedFlag(hDlg, GENERAL_PAGE, FALSE);
  99. return PSNRET_NOERROR;
  100. } else {
  101. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  102. return PSNRET_INVALID_NOCHANGEPAGE;
  103. }
  104. }
  105. break;
  106. case WM_HELP:
  107. case WM_CONTEXTMENU:
  108. return HandleHelpPopup(hDlg, message, wParam, lParam, RECEIVE_OPTIONS_PAGE);
  109. }
  110. return FALSE;
  111. }