Share

CAdUiFileDialog::OnAdUiMessage

C++

afx_msg LRESULT OnAdUiMessage(
    WPARAM wParam, 
    LPARAM lParam
);

Description

This method is provided to handle AdUi registered messages via the control's message map. If you need to override the default processing then add a handler for AdUiMessage() in your derived class's message map.

The default handler inspects the control ID encoded in wParam. If not zero and a child control corresponding to the ID is present then the message is forwarded to the control. If the child control handles the message (i.e. returns non-zero) then the reply from the child control is returned. Otherwise, if the child control does not exist or ignores the message (i.e. returns zero) then the reply from the button's DoAdUiMessage() is returned.

Returns a reply code appropriate to the message. In general zero indicates the message was ignored and non-zero indicates the message was handled.

Example

This example illustrates some of the steps needed to override OnAdUiMessage in a derived class. In the class declaration an entry in the message map needs to be added, as follows:

class CMyComboBox : public CAdUiComboBox {
...
protected:
//{{AFX_MSG(CMyComboBox)
...
afx_msg LONG OnAdUiMessage (WPARAM wParam, LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

In the class implementation, a corresponding message map entry needs to be made:

const UINT aduiMessage = AdUiMessage();

BEGIN_MESSAGE_MAP(CMyComboBox, CAdUiComboBox)
//{{AFX_MSG_MAP(CMyComboBox)
...
ON_REGISTERED_MESSAGE(aduiMessage, OnAdUiMessage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

The new handler will also need to be defined:

LONG CMyComboBox::OnAdUiMessage (WPARAM wParam, LPARAM lParam)
{
    UINT controlId = AdUiNotifyId(wParam);
    ADUI_NOTIFY notifyCode = AdUiNotification(wParam);
    ADUI_REPLY reply;

    reply = DoSomethingWithThisMessage(notifyCode, controlId, lParam);
    if (!reply)
        reply = CAdUiComboBox::OnAdUiMessage(wParam, lParam);
    return reply;
}

Parameters

Parameters Description
wParam Encodes an ADUI_NOTIFY in the high word (identifying the notification being sent or request being made) and a control ID in the low word
lParam Contains extra data for the message. Depending on the notification or request this may be a pointer to some object, or NULL.

Links

CAdUiFileDialog

Was this information helpful?