在PropertySheet中插入一PropertyPage页

int COwnerDraw_PropertySheet::InsertPage(CPropertyPage* pPage, int nIndex) { ASSERT_VALID(this); ENSURE_VALID(pPage); ASSERT_KINDOF(CPropertyPage, pPage); if(nIndex < 0 || nIndex > GetPageCount())//add to end { nIndex = GetPageCount(); } // add page to internal list m_pages.InsertAt(nIndex, pPage); // add page externally if (m_hWnd != NULL) { // build new prop page HPROPSHEETPAGE hPSP = AfxCreatePropertySheetPage(&pPage->GetPSP()); if (hPSP == NULL) AfxThrowMemoryException(); if (!SendMessage(PSM_INSERTPAGE, nIndex, (LPARAM)hPSP)) { AfxDestroyPropertySheetPage(hPSP); AfxThrowMemoryException(); } ++m_psh.nPages; } return nIndex; }

你可能感兴趣的:(null,Build)