CBN_SELENDOK should be the message you are looking for. It is sent after the user selection is completed, but before the combo box is closed (if it is). CBN_SELCHANGE dispatched before the selection is actually stored in the list control.
This MSDN link contains more information (you probably already saw it ...)
Here is the code I promised you. One thing that I noticed when compiling is that this message can be suppressed if you use the ON_CONTROL_REFLECT handler in a class derived from CComboBox . This will cause the control to process the message and not pass it to the parent. You can work around this problem by using ON_CONTROL_REFLECT_EX with the correct return code, which will make the message both the window itself and the parent message.
In any case, here is the code snippet:
class SPC_DOCK_CLASS ProcessingExceptionDockDlg : public CSPCDockDialog { SPC_DOCK_DECLARE_SERIAL(ProcessingExceptionDockDlg); public: // ... redacted ... //{{AFX_DATA(ProcessingExceptionDockDlg) CComboBox m_comboFilter; //}}AFX_DATA //{{AFX_VIRTUAL(ProcessingExceptionDockDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL protected: //{{AFX_MSG(ProcessingExceptionDockDlg) afx_msg void OnSelendokComboTreeFilter(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; /****************/ // ProcessingExceptionDockDlg.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "ProcessingExceptionDockDlg.h" // ... much code redacted ... void ProcessingExceptionDockDlg::DoDataExchange(CDataExchange* pDX) { CSPCDockDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ProcessingExceptionDockDlg) DDX_Control(pDX, IDC_COMBO_TREE_FILTER, m_comboFilter); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ProcessingExceptionDockDlg, CSPCDockDialog) //{{AFX_MSG_MAP(ProcessingExceptionDockDlg) ON_CBN_SELENDOK(IDC_COMBO_TREE_FILTER, OnSelendokComboTreeFilter) //}}AFX_MSG_MAP END_MESSAGE_MAP() void ProcessingExceptionDockDlg::OnSelendokComboTreeFilter() { // ... code redacted ... }
mwigdahl
source share