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.

58 lines
1.7 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); //This is not a safe usage. pPage should be validated. Raid #550912, yanggao.
  41. if( pPage == NULL )
  42. {
  43. return 0;
  44. }
  45. UINT nResult = (*(pPage->m_pfnOldPropCallback))(hwnd, uMsg, ppsp);
  46. if (uMsg == PSPCB_RELEASE)
  47. {
  48. delete pPage;
  49. }
  50. return nResult;
  51. }