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.

143 lines
3.1 KiB

  1. /*****************************************************************************************************************
  2. FILENAME: DlgDfrg.cpp
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. */
  5. #include "stdafx.h"
  6. #ifndef SNAPIN
  7. #ifndef NOWINDOWSH
  8. #include <windows.h>
  9. #endif
  10. #endif
  11. #include "DfrgUI.h"
  12. #include "DfrgCmn.h"
  13. #include "DfrgCtl.h"
  14. #include "resource.h"
  15. #include "DlgRpt.h"
  16. #include "DlgDfrg.h"
  17. #include "GetDfrgRes.h"
  18. #include "DfrgHlp.h"
  19. #include "VolList.h"
  20. #include "genericdialog.h"
  21. static CVolume *pLocalVolume = NULL;
  22. static HFONT hDlgFont = NULL;
  23. /*****************************************************************************************************************
  24. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  25. ROUTINE DESCRIPTION:
  26. Raises the Defrag Complete dialog
  27. GLOBAL VARIABLES:
  28. None
  29. INPUT:
  30. IN pVolume - address of volume that has just completed Analyzing
  31. RETURN:
  32. TRUE - Worked OK
  33. FALSE - Failure
  34. */
  35. BOOL RaiseDefragDoneDialog(
  36. CVolume *pVolume,
  37. IN BOOL bFragmented
  38. )
  39. {
  40. pLocalVolume = pVolume;
  41. VString dlgString;
  42. UINT iWhichKeyPressed = NULL;
  43. CGenericDialog* genericdialog = new CGenericDialog();
  44. if (!genericdialog) {
  45. return FALSE;
  46. }
  47. genericdialog->SetTitle(IDS_LABEL_DEFRAG_COMPLETE);
  48. //close button 0
  49. genericdialog->SetButtonText(0,IDS_CLOSE);
  50. //view report button 1
  51. genericdialog->SetButtonText(1,IDS_REPORT);
  52. //get the string displayed in the dialog
  53. dlgString.Empty();
  54. dlgString += GetDialogBoxTextDefrag(pLocalVolume, bFragmented);
  55. genericdialog->SetText(dlgString.GetBuffer());
  56. //set the help context IDs
  57. genericdialog->SetButtonHelp(0, IDH_102_2);
  58. genericdialog->SetButtonHelp(1, IDH_102_205);
  59. genericdialog->SetHelpFilePath();
  60. iWhichKeyPressed = genericdialog->DoModal(pLocalVolume->m_pDfrgCtl->m_hWndCD);
  61. delete genericdialog;
  62. switch(iWhichKeyPressed) {
  63. case 0:
  64. break;
  65. case 1:
  66. if(pLocalVolume->IsReportOKToDisplay()){
  67. // close the dialog before raising the report dialog
  68. // raise the report dialog
  69. RaiseReportDialog(pLocalVolume /*, DEFRAG*/);
  70. }
  71. break;
  72. default:
  73. return FALSE;
  74. }
  75. return TRUE;
  76. }
  77. VString GetDialogBoxTextDefrag(
  78. CVolume *pVolume,
  79. IN BOOL bFragmented
  80. )
  81. {
  82. // write the message that appears at the top of the dialog
  83. if (!bFragmented) {
  84. VString dlgText(IDS_DEFRAG_COMPLETE_FOR, GetDfrgResHandle());
  85. dlgText += TEXT(" ");
  86. dlgText += TEXT("\r");
  87. dlgText += TEXT("\n");
  88. dlgText += pLocalVolume->DisplayLabel();
  89. return(dlgText);
  90. }
  91. else {
  92. VString dlgText(IDS_DEFRAG_FAILED_FOR_1, GetDfrgResHandle());
  93. dlgText += pLocalVolume->DisplayLabel();
  94. VString dlgText2(IDS_DEFRAG_FAILED_FOR_2, GetDfrgResHandle());
  95. dlgText += TEXT("\r");
  96. dlgText += TEXT("\n");
  97. dlgText += TEXT("\r");
  98. dlgText += TEXT("\n");
  99. dlgText += dlgText2;
  100. return(dlgText);
  101. }
  102. }