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.

162 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. digmail.c
  5. Abstract:
  6. This file implements the dialog proc for the exchange
  7. routing profile page.
  8. Environment:
  9. WIN32 User Mode
  10. Author:
  11. Wesley Witt (wesw) 17-Feb-1996
  12. --*/
  13. #include "wizard.h"
  14. #pragma hdrstop
  15. LRESULT
  16. RouteMailDlgProc(
  17. HWND hwnd,
  18. UINT msg,
  19. WPARAM wParam,
  20. LPARAM lParam
  21. )
  22. {
  23. LONG idx;
  24. switch( msg ) {
  25. case WM_INITDIALOG:
  26. if (InstallMode == INSTALL_NEW) {
  27. GetMapiProfiles( hwnd, IDC_DEST_PROFILENAME );
  28. if (WizData.UseExchange) {
  29. //
  30. // if the user wants to use exchange for
  31. // addressing fax messages then lets
  32. // default this profile selection to the
  33. // same profile that the user chose for
  34. // addressing
  35. //
  36. idx = SendDlgItemMessage(
  37. hwnd,
  38. IDC_DEST_PROFILENAME,
  39. CB_FINDSTRING,
  40. (WPARAM) -1,
  41. (LPARAM) WizData.MapiProfile
  42. );
  43. }
  44. else{
  45. idx = 0;
  46. }
  47. }
  48. SendDlgItemMessage(
  49. hwnd,
  50. IDC_DEST_PROFILENAME,
  51. CB_SETCURSEL,
  52. idx == CB_ERR ? 0 : (WPARAM) idx,
  53. 0
  54. );
  55. CheckDlgButton( hwnd, IDC_ANS_YES, BST_UNCHECKED );
  56. CheckDlgButton( hwnd, IDC_ANS_NO, BST_CHECKED );
  57. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), FALSE );
  58. break;
  59. case WM_COMMAND:
  60. if (HIWORD(wParam) == BN_CLICKED) {
  61. switch (LOWORD(wParam)) {
  62. case IDC_ANS_YES:
  63. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), TRUE );
  64. SetFocus( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ));
  65. break;
  66. case IDC_ANS_NO:
  67. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), FALSE );
  68. }
  69. }
  70. break;
  71. case WM_NOTIFY:
  72. switch( ((LPNMHDR)lParam)->code ) {
  73. case PSN_SETACTIVE:
  74. if (Unattended) {
  75. UnAttendGetAnswer(
  76. UAA_ROUTE_MAIL,
  77. (LPBYTE) &WizData.RouteMail,
  78. sizeof(WizData.RouteMail)
  79. );
  80. if (WizData.RouteMail) {
  81. WizData.UseExchange = TRUE;
  82. UnAttendGetAnswer(
  83. UAA_ROUTE_PROFILENAME,
  84. (LPBYTE) WizData.RouteProfile,
  85. sizeof(WizData.RouteProfile)
  86. );
  87. if (_wcsicmp( WizData.RouteProfile, L"<default>" ) == 0) {
  88. if (!GetDefaultMapiProfile( WizData.RouteProfile )) {
  89. DWORD Size = sizeof(WizData.RouteProfile);
  90. GetUserName( WizData.RouteProfile, &Size );
  91. }
  92. }
  93. }
  94. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  95. return TRUE;
  96. }
  97. if (InstallMode != INSTALL_NEW) {
  98. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  99. return TRUE;
  100. }
  101. break;
  102. case PSN_WIZNEXT:
  103. WizData.RouteMail = IsDlgButtonChecked( hwnd, IDC_ANS_YES );
  104. if (WizData.RouteMail) {
  105. LONG idx = SendDlgItemMessage(
  106. hwnd,
  107. IDC_DEST_PROFILENAME,
  108. CB_GETCURSEL,
  109. 0,
  110. 0
  111. );
  112. WizData.UseExchange = TRUE;
  113. if (idx != CB_ERR) {
  114. if (idx == 0) {
  115. if (!GetDefaultMapiProfile( WizData.RouteProfile )) {
  116. DWORD Size = sizeof(WizData.RouteProfile);
  117. GetUserName( WizData.RouteProfile, &Size );
  118. }
  119. } else {
  120. SendDlgItemMessage(
  121. hwnd,
  122. IDC_DEST_PROFILENAME,
  123. CB_GETLBTEXT,
  124. (WPARAM) idx,
  125. (LPARAM) WizData.RouteProfile
  126. );
  127. }
  128. }
  129. }
  130. if ((!WizData.RoutePrint) && (!WizData.RouteStore) && (!WizData.RouteMail)) {
  131. PopUpMsg( hwnd, IDS_ROUTING_REQUIRED, TRUE, 0 );
  132. SetWindowLong( hwnd, DWL_MSGRESULT, IDD_ROUTE_STOREDIR_PAGE );
  133. return TRUE;
  134. }
  135. break;
  136. }
  137. break;
  138. }
  139. return FALSE;
  140. }