Microsoft DirectX 8.1 (C++) |
The OnReceiveMessage method is called when the dialog box receives a message.
Syntax
virtual BOOL OnReceiveMessage(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
Parameters
hwnd
Handle to the window.
uMsg
Message.
wParam
First message parameter.
lParam
Second message parameter.
Return Value
Returns a Boolean value. The dialog procedure returns this value; for more information, see the Platform SDK documentation.
Remarks
The base-class implementation calls DefWindowProc. Override this method to handle messages that relate to the dialog controls. If the overriding method does not handle a particular message, it should call the base-class method.
If the user changes any properties via the dialog controls, set the CBasePropertyPage::m_bDirty flag to TRUE. Then call the IPropertyPageSite::OnStatusChange method on the CBasePropertyPage::m_pPageSite pointer to inform the frame.
Example Code
The following example responds to a button click by updating a member variable, which is assumed to be defined in the derived class. This example also shows a helper function for setting the property page's dirty status.
BOOL CMyProp::OnReceiveMessage(HWND hwnd,
UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
if (LOWORD(wParam) == IDC_BUTTON1)
{
m_lNewVal = GetDlgItemInt(m_Dlg, IDC_EDIT1, 0, TRUE);
SetDirty();
return TRUE;
}
break;
} // switch
// Did not handle the message.
return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
}
// Helper function to update the dirty status.
void CMyProp::SetDirty()
{
m_bDirty = TRUE;
if (m_pPageSite)
{
m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
}
}
See Also