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.

136 lines
4.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. dlgexchg.c
  5. Abstract:
  6. This file implements the dialog proc for the exchange install page.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Wesley Witt (wesw) 7-Aug-1996
  11. --*/
  12. #include "wizard.h"
  13. #pragma hdrstop
  14. LRESULT
  15. ExchangeDlgProc(
  16. HWND hwnd,
  17. UINT msg,
  18. WPARAM wParam,
  19. LPARAM lParam
  20. )
  21. {
  22. switch( msg ) {
  23. case WM_INITDIALOG:
  24. if (InstallMode == INSTALL_NEW) {
  25. GetMapiProfiles( hwnd, IDC_DEST_PROFILENAME );
  26. }
  27. CheckDlgButton( hwnd, IDC_ANS_YES, BST_UNCHECKED );
  28. CheckDlgButton( hwnd, IDC_ANS_NO, BST_CHECKED );
  29. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), FALSE );
  30. SendDlgItemMessage(
  31. hwnd,
  32. IDC_DEST_PROFILENAME,
  33. CB_SETCURSEL,
  34. 0,
  35. 0
  36. );
  37. break;
  38. case WM_COMMAND:
  39. if (HIWORD(wParam) == BN_CLICKED) {
  40. switch (LOWORD(wParam)) {
  41. case IDC_ANS_YES:
  42. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), TRUE );
  43. SetFocus( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ));
  44. break;
  45. case IDC_ANS_NO:
  46. EnableWindow( GetDlgItem( hwnd, IDC_DEST_PROFILENAME ), FALSE );
  47. }
  48. }
  49. break;
  50. case WM_NOTIFY:
  51. switch( ((LPNMHDR)lParam)->code ) {
  52. case PSN_SETACTIVE:
  53. if (Unattended) {
  54. UnAttendGetAnswer(
  55. UAA_USE_EXCHANGE,
  56. (LPBYTE) &WizData.UseExchange,
  57. sizeof(WizData.UseExchange)
  58. );
  59. if (WizData.UseExchange) {
  60. UnAttendGetAnswer(
  61. UAA_DEST_PROFILENAME,
  62. (LPBYTE) WizData.MapiProfile,
  63. sizeof(WizData.MapiProfile)
  64. );
  65. if (_wcsicmp( WizData.MapiProfile, L"<default>" ) == 0) {
  66. if (!GetDefaultMapiProfile( WizData.MapiProfile )) {
  67. DWORD Size = sizeof(WizData.MapiProfile);
  68. GetUserName( WizData.MapiProfile, &Size );
  69. }
  70. }
  71. }
  72. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  73. return TRUE;
  74. }
  75. if (InstallMode != INSTALL_NEW) {
  76. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  77. return TRUE;
  78. }
  79. break;
  80. case PSN_WIZNEXT:
  81. WizData.UseExchange = IsDlgButtonChecked( hwnd, IDC_ANS_YES );
  82. if (WizData.UseExchange) {
  83. LONG idx = SendDlgItemMessage(
  84. hwnd,
  85. IDC_DEST_PROFILENAME,
  86. CB_GETCURSEL,
  87. 0,
  88. 0
  89. );
  90. if (idx != CB_ERR) {
  91. if (idx == 0) {
  92. if (MapiAvail) {
  93. if (!GetDefaultMapiProfile( WizData.MapiProfile )) {
  94. DWORD Size = sizeof(WizData.MapiProfile);
  95. GetUserName( WizData.MapiProfile, &Size );
  96. }
  97. } else {
  98. DWORD Size = sizeof(WizData.MapiProfile);
  99. GetUserName( WizData.MapiProfile, &Size );
  100. }
  101. } else {
  102. SendDlgItemMessage(
  103. hwnd,
  104. IDC_DEST_PROFILENAME,
  105. CB_GETLBTEXT,
  106. (WPARAM) idx,
  107. (LPARAM) WizData.MapiProfile
  108. );
  109. }
  110. }
  111. }
  112. break;
  113. }
  114. break;
  115. }
  116. return FALSE;
  117. }