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.

111 lines
2.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: M S C L I D L G . C P P
  7. //
  8. // Contents: Dialog box handling for the MSCLient object.
  9. //
  10. // Notes:
  11. //
  12. // Author: danielwe 28 Feb 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "msclidlg.h"
  18. //+---------------------------------------------------------------------------
  19. //
  20. // Member: CMSClient::HrSetupPropSheets
  21. //
  22. // Purpose: Inits the prop sheet page objects and creates the pages to be
  23. // returned to the installer object.
  24. //
  25. // Arguments:
  26. // pahpsp [out] Array of handles to property sheet pages.
  27. // cPages [in] Number of pages to create.
  28. //
  29. // Returns: HRESULT, Error code.
  30. //
  31. // Author: danielwe 28 Feb 1997
  32. //
  33. // Notes:
  34. //
  35. HRESULT CMSClient::HrSetupPropSheets(HPROPSHEETPAGE **pahpsp, INT cPages)
  36. {
  37. HRESULT hr = S_OK;
  38. HPROPSHEETPAGE *ahpsp = NULL;
  39. Assert(pahpsp);
  40. *pahpsp = NULL;
  41. // Allocate a buffer large enough to hold the handles to all of our
  42. // property pages.
  43. ahpsp = (HPROPSHEETPAGE *)CoTaskMemAlloc(sizeof(HPROPSHEETPAGE)
  44. * cPages);
  45. if (!ahpsp)
  46. {
  47. hr = E_OUTOFMEMORY;
  48. goto err;
  49. }
  50. if (!m_apspObj[0])
  51. {
  52. // Allocate each of the CPropSheetPage objects
  53. m_apspObj[0] = new CRPCConfigDlg(this);
  54. }
  55. #ifdef DBG
  56. else
  57. {
  58. // Don't bother creating new classes if they already exist.
  59. AssertSz(m_apspObj[0], "Not all prop page objects are non-NULL!");
  60. }
  61. #endif
  62. // Create the actual PROPSHEETPAGE for each object.
  63. // This needs to be done regardless of whether the classes existed before.
  64. ahpsp[0] = m_apspObj[0]->CreatePage(DLG_RPCConfig, 0);
  65. Assert(SUCCEEDED(hr));
  66. *pahpsp = ahpsp;
  67. cleanup:
  68. TraceError("HrSetupPropSheets", hr);
  69. return hr;
  70. err:
  71. CoTaskMemFree(ahpsp);
  72. goto cleanup;
  73. }
  74. //+---------------------------------------------------------------------------
  75. //
  76. // Member: CMSClient::CleanupPropPages
  77. //
  78. // Purpose: Loop thru each of the pages and free the objects associated
  79. // with them.
  80. //
  81. // Arguments:
  82. // (none)
  83. //
  84. // Returns: Nothing.
  85. //
  86. // Author: danielwe 28 Feb 1997
  87. //
  88. // Notes:
  89. //
  90. VOID CMSClient::CleanupPropPages()
  91. {
  92. INT ipage;
  93. for (ipage = 0; ipage < c_cPages; ipage++)
  94. {
  95. delete m_apspObj[ipage];
  96. m_apspObj[ipage] = NULL;
  97. }
  98. }