Leaked source code of windows server 2003
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.

120 lines
2.8 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. SchedSht.cpp
  5. Abstract:
  6. CScheduleSheet - Class that allows a schedule to be edited
  7. in a property sheet of its own.
  8. Author:
  9. Rohde Wakefield [rohde] 12-Aug-1997
  10. Revision History:
  11. --*/
  12. #include "stdafx.h"
  13. #include "SchedSht.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CScheduleSheet
  16. CScheduleSheet::CScheduleSheet(UINT nIDCaption, ITask * pTask, CWnd* pParentWnd, DWORD /*dwFlags*/)
  17. :CPropertySheet(nIDCaption, pParentWnd, 0)
  18. {
  19. HRESULT hr = S_OK;
  20. try {
  21. //
  22. // Save the scheduled task pointer
  23. //
  24. WsbAffirmPointer( pTask );
  25. m_pTask = pTask;
  26. //
  27. // Get the property page structures
  28. //
  29. CComPtr<IProvideTaskPage> pProvideTaskPage;
  30. WsbAffirmHr( pTask->QueryInterface( IID_IProvideTaskPage, (void**)&pProvideTaskPage ) );
  31. WsbAffirmHr( pProvideTaskPage->GetPage( TASKPAGE_SCHEDULE, FALSE, &m_hSchedulePage ) );
  32. // WsbAffirmHr( pProvideTaskPage->GetPage( TASKPAGE_SETTINGS, FALSE, &m_hSettingsPage ) );
  33. } WsbCatch( hr );
  34. }
  35. CScheduleSheet::~CScheduleSheet()
  36. {
  37. //
  38. // Set the pointer to the PROPSHEETHEADER array to
  39. // null since MFC will try to free it when we are
  40. // destroyed.
  41. //
  42. m_psh.ppsp = 0;
  43. }
  44. BEGIN_MESSAGE_MAP(CScheduleSheet, CPropertySheet)
  45. //{{AFX_MSG_MAP(CScheduleSheet)
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. void
  49. CScheduleSheet::BuildPropPageArray
  50. (
  51. void
  52. )
  53. {
  54. CPropertySheet::BuildPropPageArray( );
  55. //
  56. // We put in a dummy set of pages to keep MFC happy.
  57. // Here we will substitute our own array of HPROPSHEETPAGE's
  58. // instead, since this is all Task Scheduler gives us.
  59. //
  60. m_psh.dwFlags &= ~PSH_PROPSHEETPAGE;
  61. m_psh.dwFlags |= PSH_NOAPPLYNOW;
  62. m_psh.phpage = &m_hSchedulePage;
  63. m_psh.nPages = 1;
  64. }
  65. BOOL CScheduleSheet::OnInitDialog()
  66. {
  67. BOOL bResult = CPropertySheet::OnInitDialog();
  68. LONG style = ::GetWindowLong( m_hWnd, GWL_EXSTYLE );
  69. style |= WS_EX_CONTEXTHELP;
  70. ::SetWindowLong( m_hWnd, GWL_EXSTYLE, style );
  71. return bResult;
  72. }
  73. #ifdef _DEBUG
  74. void CScheduleSheet::AssertValid() const
  75. {
  76. //
  77. // Need to override so that CPropSheet is happy
  78. // Note that this code duplicates what is in
  79. // CPropertySheet::AssertValid except the assertion
  80. // the dwFlags has the PSH_PROPSHEETPAGE bit set
  81. // We assert that it is not set
  82. //
  83. CWnd::AssertValid();
  84. m_pages.AssertValid();
  85. ASSERT(m_psh.dwSize == sizeof(PROPSHEETHEADER));
  86. //ASSERT((m_psh.dwFlags & PSH_PROPSHEETPAGE) == PSH_PROPSHEETPAGE);
  87. }
  88. #endif