Using ON_UPDATE_COMMAND_UI message maps in property pages is the same as in dialogs except for one extra step required.
You need to derive a class from CPropertySheet and intercept the WM_KICKIDLE messages.
1. Use class wizard to create a new class called CMyPropSheet with a base class of CPropertSheet.
2. In the header add the message function. afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM, LPARAM);
3. In the source file #include afxpriv.h
4. Add the message map ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
5. Implement the function.
LRESULT CMyPropSheet::OnKickIdle(WPARAM, LPARAM) { SendMessageToDescendants(WM_WM_KICKIDLE, 0, 0, FALSE, FALSE); return 0; }
The property sheet now passes all WM_KICKIDLE message to its property pages.
In the property page class, just add a message map for WM_KICKIDLE and call UpdateDialogControls.
LRESULT CMyPropPage::OnKickIdle(WPARAM, LPARAM) { UpdateDialogControls(this, FALSE); return 0L; }
Then all you need is ON_UPDATE_COMMAND_UI message maps.
P.S.
This does not work for modeless property sheets.
You need to trap the WM_IDLEUPDATECMDUI message in the property sheet’s
owner window and send it WK_KICKIDLE messages.
Date Posted: 08/13/98