title: How do I get my subclassed combo box messages to forward their messages to the parent toolbar?
body: <p>I have five combo boxes on the toolbar and I want to process their messages and notification , particularly CBN_SELCHANGE notification int the subclassed toolbar class. I have tried several approaches to no avail. The deinition of the tool bar and combo box classes are shown below:</p>
  
  <pre><code>#pragma once
  // CMyComboBox
  
  class CMyComboBox : public CComboBox
  {
      DECLARE_DYNAMIC(CMyComboBox)
  
  public:
      CMyComboBox();
      virtual ~CMyComboBox();
  
  protected:
      DECLARE_MESSAGE_MAP()
  public:
      afx_msg BOOL OnCbnSelchange();
      //afx_msg void OnCbnSelchange();
  };
  
  
  
  
  
  // MyComboBox.cpp : implementation file
  //
  
  #include "stdafx.h"
  #include "MyComboBox.h"
  
  
  IMPLEMENT_DYNAMIC(CMyComboBox, CComboBoxEx)
  
  CMyComboBox::CMyComboBox()
  {
  
  }
  
  CMyComboBox::~CMyComboBox()
  {
  }
  
  
  BEGIN_MESSAGE_MAP(CMyComboBox, CComboBoxEx)
      //ON_CONTROL_REFLECT(CBN_SELCHANGE, &amp;CMyComboBox::OnCbnSelchange)
      ON_CONTROL_REFLECT_EX(CBN_SELCHANGE, &amp;CMyComboBox::OnCbnSelchange)
  END_MESSAGE_MAP()
  
  
  
  // CMyComboBox message handlers
  
  
  BOOL CMyComboBox::OnCbnSelchange()
  {
      return FALSE;
  }
  
  
  #pragma once
  #include "MyStatic.h"
  #include "MyComboBox.h"
  
  // MyToolBar
  
  class CMyToolBar : public CMFCToolBar
  {
      DECLARE_DYNAMIC(CMyToolBar)
  
  public:
      CMyToolBar();
      virtual ~CMyToolBar();
  
  public:
      void EmbedControls();
      //CMyStatic m_pStatic3;
      CMyComboBox m_Combo1,m_Combo2,m_Combo3,m_Combo4,m_Combo5;
      CWnd m_pEdit1;
      CFont m_font;
  private:
  public:
      afx_msg void OnCbnSelchange1();
      afx_msg void OnCbnSelchange2();
      afx_msg void OnCbnSelchange3();
      afx_msg void OnCbnSelchange4();
      afx_msg void OnCbnSelchange5();
  protected:
      DECLARE_MESSAGE_MAP()
  //public:
      //afx_msg void OnSize(UINT nType, int cx, int cy);
  };
  
  
  
  
  IMPLEMENT_DYNAMIC(CMyToolBar, CMFCToolBar)
  
  CMyToolBar::CMyToolBar()
  {
  }
  
  CMyToolBar::~CMyToolBar()
  {
  }
  
  
  BEGIN_MESSAGE_MAP(CMyToolBar, CMFCToolBar)
      ON_CBN_SELCHANGE(ID_COMBO1, &amp;CMyToolBar::OnCbnSelchange1)
      ON_CBN_SELCHANGE(ID_COMBO2, &amp;CMyToolBar::OnCbnSelchange2)
      ON_CBN_SELCHANGE(ID_COMBO3, &amp;CMyToolBar::OnCbnSelchange3)
      ON_CBN_SELCHANGE(ID_COMBO4, &amp;CMyToolBar::OnCbnSelchange4)
      ON_CBN_SELCHANGE(ID_COMBO5, &amp;CMyToolBar::OnCbnSelchange5)
      //ON_WM_SIZE()
  END_MESSAGE_MAP()
  
  
  
  // MyToolBar message handlers
  #include "stdAfx.h"
  #include "MyToolBar.h"
  void CMyToolBar::OnCbnSelchange1()
  {
    //Operation1
  }
  
  void CMyToolBar::OnCbnSelchange2()
  {
   //Operation1
  }
  
  void CMyToolBar::OnCbnSelchange2()
  {
   //Operation2
  }
  
  void CMyToolBar::OnCbnSelchange3()
  {
   //Operation3
  }
  
  void CMyToolBar::OnCbnSelchange4()
  {
   //Operation4
  }
  
  void CMyToolBar::OnCbnSelchange5()
  {
   //Operation5
  }
  
  void CMyToolBar:EmbedControls()
  {
  //Creates five comboboxes of type MyComboBox and embeds then on the tool bar
  }
  </code></pre>
  
  <p>The problem is that neither of operations 1 to 4 is being carried out signifying that selection change messages were not reaching the toolbar. Stepping into the code at runtime also confirm this.</p>
  
  <p>So, how do I get the combo boxes to forward messages to the toolbar for processiing?</p>