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.

54 lines
1.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2001
  6. //
  7. // File: SelfDeletingPropertyPage.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "SelfDeletingPropertyPage.h"
  12. IMPLEMENT_DYNCREATE(CSelfDeletingPropertyPage, CPropertyPage)
  13. CSelfDeletingPropertyPage::CSelfDeletingPropertyPage ()
  14. : CPropertyPage ()
  15. {
  16. m_pfnOldPropCallback = m_psp.pfnCallback;
  17. m_psp.pfnCallback = PropSheetPageProc;
  18. }
  19. CSelfDeletingPropertyPage::CSelfDeletingPropertyPage (UINT nIDTemplate, UINT nIDCaption)
  20. : CPropertyPage (nIDTemplate, nIDCaption)
  21. {
  22. m_pfnOldPropCallback = m_psp.pfnCallback;
  23. m_psp.pfnCallback = PropSheetPageProc;
  24. }
  25. CSelfDeletingPropertyPage::CSelfDeletingPropertyPage (LPCTSTR lpszTemplateName, UINT nIDCaption)
  26. : CPropertyPage (lpszTemplateName, nIDCaption)
  27. {
  28. m_pfnOldPropCallback = m_psp.pfnCallback;
  29. m_psp.pfnCallback = PropSheetPageProc;
  30. }
  31. CSelfDeletingPropertyPage::~CSelfDeletingPropertyPage ()
  32. {
  33. }
  34. UINT CALLBACK CSelfDeletingPropertyPage::PropSheetPageProc(
  35. HWND hwnd,
  36. UINT uMsg,
  37. LPPROPSHEETPAGE ppsp)
  38. {
  39. CSelfDeletingPropertyPage* pPage = (CSelfDeletingPropertyPage*)(ppsp->lParam);
  40. ASSERT(pPage != NULL);
  41. UINT nResult = (*(pPage->m_pfnOldPropCallback))(hwnd, uMsg, ppsp);
  42. if (uMsg == PSPCB_RELEASE)
  43. {
  44. delete pPage;
  45. }
  46. return nResult;
  47. }