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.

173 lines
5.3 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1994 **
  4. //*********************************************************************
  5. //
  6. // SERVERR.CPP - Functions for server error page
  7. //
  8. // HISTORY:
  9. //
  10. // 06/14/98 vyung created
  11. //
  12. //*********************************************************************
  13. #include "pre.h"
  14. #include "htmlhelp.h"
  15. /*******************************************************************
  16. NAME: ServErrorInitProc
  17. SYNOPSIS: Called when page is displayed
  18. ENTRY: hDlg - dialog window
  19. fFirstInit - TRUE if this is the first time the dialog
  20. is initialized, FALSE if this InitProc has been called
  21. before (e.g. went past this page and backed up)
  22. ********************************************************************/
  23. BOOL CALLBACK ServErrorInitProc
  24. (
  25. HWND hDlg,
  26. BOOL fFirstInit,
  27. UINT *puNextPage
  28. )
  29. {
  30. BOOL bRet = TRUE;
  31. if (!fFirstInit)
  32. {
  33. // if we've travelled through external apprentice pages,
  34. // it's easy for our current page pointer to get munged,
  35. // so reset it here for sanity's sake.
  36. gpWizardState->uCurrentPage = ORD_PAGE_REFSERVERR;
  37. switch (gpWizardState->lRefDialTerminateStatus)
  38. {
  39. case SP_OUTOFDISK:
  40. case ERROR_PATH_NOT_FOUND: //Occurs when download could not be created due to lack of space
  41. case ERROR_DISK_FULL:
  42. {
  43. TCHAR szErr [MAX_MESSAGE_LEN*3] = TEXT("\0");
  44. LoadString(g_hInstance, IDS_NOT_ENOUGH_DISKSPACE, szErr, ARRAYSIZE(szErr));
  45. SetWindowText(GetDlgItem(hDlg, IDC_SERVERR_TEXT), szErr);
  46. break;
  47. }
  48. case INTERNET_CONNECTION_OFFLINE:
  49. {
  50. TCHAR szErr [MAX_MESSAGE_LEN*3] = TEXT("\0");
  51. LoadString(g_hInstance, IDS_CONNECTION_OFFLINE, szErr, ARRAYSIZE(szErr));
  52. SetWindowText(GetDlgItem(hDlg, IDC_SERVERR_TEXT), szErr);
  53. break;
  54. }
  55. default:
  56. {
  57. if(gpWizardState->bStartRefServDownload)
  58. {
  59. TCHAR szErr [MAX_MESSAGE_LEN*3] = TEXT("\0");
  60. LoadString(g_hInstance, IDS_SERVER_ERROR_COMMON, szErr, ARRAYSIZE(szErr));
  61. SetWindowText(GetDlgItem(hDlg, IDC_SERVERR_TEXT), szErr);
  62. }
  63. else
  64. {
  65. BSTR bstrErrMsg = NULL;
  66. gpWizardState->pRefDial->get_DialErrorMsg(&bstrErrMsg);
  67. SetWindowText(GetDlgItem(hDlg, IDC_SERVERR_TEXT), W2A(bstrErrMsg));
  68. SysFreeString(bstrErrMsg);
  69. }
  70. break;
  71. }
  72. }
  73. // Currently this is removed from BETA 2
  74. //BSTR bstrSupportPhoneNum = NULL;
  75. //TCHAR szFmt [MAX_MESSAGE_LEN*3];
  76. //gpWizardState->pRefDial->get_SupportNumber(&bstrSupportPhoneNum);
  77. //if (bstrSupportPhoneNum)
  78. //{
  79. // LoadString(g_hInstance, IDS_DIALERR_HELP, szFmt, ARRAYSIZE(szFmt));
  80. // lstrcat(szFmt, W2A(bstrSupportPhoneNum));
  81. // SetWindowText(GetDlgItem(hDlg, IDC_SERVERR_HELP), szFmt);
  82. // SysFreeString(bstrSupportPhoneNum);
  83. // ShowWindow(GetDlgItem(hDlg, IDC_SERVERR_HELP), SW_SHOW);
  84. //}
  85. //else
  86. // ShowWindow(GetDlgItem(hDlg, IDC_SERVERR_HELP), SW_HIDE);
  87. }
  88. return bRet;
  89. }
  90. /*******************************************************************
  91. NAME: ServErrorOKProc
  92. SYNOPSIS: Called when Next or Back btns pressed from page
  93. ENTRY: hDlg - dialog window
  94. fForward - TRUE if 'Next' was pressed, FALSE if 'Back'
  95. puNextPage - if 'Next' was pressed,
  96. proc can fill this in with next page to go to. This
  97. parameter is ingored if 'Back' was pressed.
  98. pfKeepHistory - page will not be kept in history if
  99. proc fills this in with FALSE.
  100. EXIT: returns TRUE to allow page to be turned, FALSE
  101. to keep the same page.
  102. ********************************************************************/
  103. BOOL CALLBACK ServErrorOKProc
  104. (
  105. HWND hDlg,
  106. BOOL fForward,
  107. UINT *puNextPage,
  108. BOOL *pfKeepHistory
  109. )
  110. {
  111. ASSERT(puNextPage);
  112. // Initialze status before connecting
  113. gpWizardState->lRefDialTerminateStatus = ERROR_SUCCESS;
  114. gpWizardState->bDoneRefServDownload = FALSE;
  115. gpWizardState->bDoneRefServRAS = FALSE;
  116. gpWizardState->bStartRefServDownload = FALSE;
  117. if (fForward)
  118. {
  119. *pfKeepHistory = FALSE;
  120. *puNextPage = ORD_PAGE_REFSERVDIAL;
  121. }
  122. else
  123. {
  124. BOOL bRetVal;
  125. // Set userpick to FALSE to regenerate connectoid
  126. gpWizardState->bDoUserPick = FALSE;
  127. gpWizardState->pRefDial->RemoveConnectoid(&bRetVal);
  128. }
  129. return TRUE;
  130. }
  131. BOOL CALLBACK ServErrorCmdProc
  132. (
  133. HWND hDlg,
  134. WPARAM wParam,
  135. LPARAM lParam
  136. )
  137. {
  138. if ((GET_WM_COMMAND_CMD (wParam, lParam) == BN_CLICKED) &&
  139. (GET_WM_COMMAND_ID (wParam, lParam) == IDC_DIAL_HELP))
  140. {
  141. HtmlHelp(NULL, ICW_HTML_HELP_TROUBLE_TOPIC, HH_DISPLAY_TOPIC, NULL);
  142. }
  143. return TRUE;
  144. }