Article ID: 148388
Article Last Modified on 11/21/2006
// this is the user-defined message
#define WM_SETPAGEFOCUS WM_APP+2
BEGIN_MESSAGE_MAP(CMyPage, CPropertyPage)
ON_MESSAGE(WM_SETPAGEFOCUS, OnSetPageFocus)
END_MESSAGE_MAP()
BOOL CMyPage::OnSetActive()
{
BOOL fRet = CPropertyPage::OnSetActive();
PostMessage(WM_SETPAGEFOCUS, 0, 0L);
return fRet;
}
LONG CMyPage::OnSetPageFocus(UINT wParam, LONG lParam)
{
// IDC_BUTTON2 is the button on this property page
// that you want to give the default focus.
CButton* pBtn = (CButton*)GetDlgItem(IDC_BUTTON2);
ASSERT(pBtn);
pBtn->SetFocus();
return 0;
}
Additional query words: kbinf 4.00 CPropertySheet
Keywords: kbcode kbctrl kbhowto kbnoupdate kbuidesign KB148388