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.

118 lines
3.0 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // cancel.c
  8. //
  9. // Description:
  10. // This file contains the routine that should be called when the
  11. // user pushes the cancel button on the wizard.
  12. //
  13. // Call this routine in response to a PSN_QUERYCANCEL only. Do not
  14. // call it under any other circumstances as it sets the DWLP_MSGRESULT
  15. // in a fashion that is specific to PSN_QUERYCANCEL.
  16. //
  17. //----------------------------------------------------------------------------
  18. #include "pch.h"
  19. #include "allres.h"
  20. static TCHAR *StrWarnCancelWizard = NULL;
  21. //----------------------------------------------------------------------------
  22. //
  23. // Function: CancelTheWizard
  24. //
  25. // Purpose: Give the user one last chance to not cancel the wizard. If they
  26. // really want to cancel, we route the wizard to the unsuccessful
  27. // completion page.
  28. //
  29. // Arguments:
  30. // HWND hwnd - current window
  31. //
  32. // Returns:
  33. // VOID
  34. //
  35. //----------------------------------------------------------------------------
  36. VOID CancelTheWizard(HWND hwnd)
  37. {
  38. int iRet;
  39. HWND hPropSheet = GetParent(hwnd);
  40. if( StrWarnCancelWizard == NULL )
  41. {
  42. StrWarnCancelWizard = MyLoadString( IDS_WARN_CANCEL_WIZARD );
  43. }
  44. if( g_StrWizardTitle == NULL )
  45. {
  46. g_StrWizardTitle = MyLoadString( IDS_WIZARD_TITLE );
  47. }
  48. iRet = MessageBox( hwnd,
  49. StrWarnCancelWizard,
  50. g_StrWizardTitle,
  51. MB_YESNO | MB_DEFBUTTON2 );
  52. // ISSUE-2002/02/28-stelo -Do a message box here so the default is NO
  53. //iRet = ReportErrorId(hwnd, MSGTYPE_YESNO, IDS_WARN_CANCEL_WIZARD);
  54. //
  55. // Never exit the wizard, we want to jump to the unsuccessful completion
  56. // page if user says yes.
  57. //
  58. SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
  59. //
  60. // Ok, now go to the unsuccessful completion page is user said yes.
  61. // Otherwise, we'll stay on the same page.
  62. //
  63. if ( iRet == IDYES ) {
  64. PostMessage(hPropSheet,
  65. PSM_SETCURSELID,
  66. (WPARAM) 0,
  67. (LPARAM) IDD_FINISH2);
  68. }
  69. }
  70. //----------------------------------------------------------------------------
  71. //
  72. // Function: TerminateTheWizard
  73. //
  74. // Purpose: Unconditionally terminate the wizard due to a fatal error
  75. //
  76. // Arguments:
  77. // int iErrorID
  78. //
  79. // Returns:
  80. // VOID
  81. //
  82. //----------------------------------------------------------------------------
  83. VOID TerminateTheWizard
  84. (
  85. int iErrorID
  86. )
  87. {
  88. TCHAR szTitle[128];
  89. TCHAR szMsg[128];
  90. LoadString(FixedGlobals.hInstance,
  91. iErrorID,
  92. szMsg,
  93. sizeof(szMsg)/sizeof(TCHAR));
  94. LoadString(FixedGlobals.hInstance,
  95. IDS_WIZARD_TITLE,
  96. szTitle,
  97. sizeof(szTitle)/sizeof(TCHAR));
  98. MessageBox(NULL, szMsg, szTitle, MB_OK);
  99. ExitProcess(0);
  100. }