'How to capture windows message from the up/down button of a CDateTimeCtrl control?
I am using a CDateTimeCtrl, along with a callback field, in my dialog application. All works well as intended but I want to capture the windows message when the up-down button ( looks a lot like the spin control) of the CDateTimeCtrl is clicked without success. Spy++ reported the class of the up-down button to be msctls_updown32. Spy++ message log offer no clue either. How do I capture the mouse click messages from this up-down control ( looks like an OLE control to me)?
Edited: : I've tried handling the UDN_DELTAPOS message like so but still unable to capture the message from CMyTimeCtrl.
class CMyTimeCtrl : public CDateTimeCtrl
{
DECLARE_DYNAMIC(CMyTimeCtrl)
public:
CMyTimeCtrl();
virtual ~CMyTimeCtrl();
protected:
int m_msec;
DECLARE_MESSAGE_MAP()
public:
virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnDtnFormat(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDtnFormatquery(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDtnWmkeydown(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult);
};
BEGIN_MESSAGE_MAP(CMyTimeCtrl, CDateTimeCtrl)
ON_NOTIFY(WM_NOTIFY, UDN_DELTAPOS, &CMyTimeCtrl::OnDeltaposSpin)
ON_NOTIFY_REFLECT(DTN_FORMAT, &CMyTimeCtrl::OnDtnFormat)
ON_NOTIFY_REFLECT(DTN_FORMATQUERY, &CMyTimeCtrl::OnDtnFormatquery)
ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, &CMyTimeCtrl::OnDtnWmkeydown)
END_MESSAGE_MAP()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
