Usually it's enough to override OnSetActive(). However, this method is called before the CPropertyPage is made visible and focused. If you have to perform a task after the page is shown, you have to post your own message in OnSetActive:
// This message will be received after CMyPropertyPage is shown
#define WM_SHOWPAGE WM_APP+2
BOOL CMyPropertyPage::OnSetActive() {
if(CPropertyPage::OnSetActive()) {
PostMessage(WM_SHOWPAGE, 0, 0L); // post the message
return TRUE;
}
return FALSE;
}
LRESULT CMyPropertyPage::OnShowPage(UINT wParam, LONG lParam) {
MessageBox(TEXT("Page is visible. [TODO: your code]"));
return 0L;
}
BEGIN_MESSAGE_MAP(CMyPropertyPage,CPropertyPage)
ON_MESSAGE(WM_SHOWPAGE, OnShowPage) // add message handler
// ...
END_MESSAGE_MAP()