实现步骤(假设我们锁定第一页,m_nLastActive值置为0)
1、覆盖Sheet类的OnNotify函数
BOOL CMyPropertySheet::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pnmh = (NMHDR*)lParam;
// tab is about to change
if (TCN_SELCHANGING == pnmh->code)
// save the current page index
m_nLastActive = GetActiveIndex ();
// tab has been changed
else if (TCN_SELCHANGE == pnmh->code)
{
// get the current page index
int nCurrentPage = GetActiveIndex ();
// if current page is in our map of disabled pages
if (m_nLastActive != nCurrentPage)
// activate the previous page
PostMessage (PSM_SETCURSEL, m_nLastActive);
}
return CPropertySheet::OnNotify(wParam, lParam, pResult);
}