Why the messages of a control are not intercepted by the owner class?

I'm trying to code a simple grid view class based on the CListView class. In order to accomplish this task I created one class (CGridView) based on the ClistView class and one class (CGridEdit) based on the CEdit class. I would like to intercept EN_KILLFOCUS messages of CGridEdit in CGridView, but they never get there. This is the code:

// CGridView::OnInitialUpdate()
CRect rect; 
EditField = new CGridEdit(m_hWnd);
EditField->Create(WS_CHILD | ES_AUTOHSCROLL | ES_CENTER, rect, this, 0);

// Message Map entry

// actual function
afx_msg LRESULT CGridView::OnEditFieldLostFocus(WPARAM wParam, LPARAM lParam)
    if(lParam == (LPARAM)EditField->m_hWnd)
        // this never executes

So the as the title says, why is this not working? I get some messages from CListView controls but the one from CEdit never gets there.. Thank you in advance for any help.


EN_KILLFOCUS isn't a message, it's a notification received via the WM_COMMAND message. You need to use ON_CONTROL in your message map.

Need Your Help

MongoDB one query with multiple OR or multiple queries?

javascript mongodb mongoose

Every user has a mobile number, and I want to check there are other users in my address book.