1. In resource. h defines a combo box ID [cpp] # define ID_MY_COMBOBOX 1032 2. add a BUTTON [cpp] IDR_MAINFRAME TOOLBAR 16, 15 BEGIN ...... BUTTON ID_MY_COMBOBOX ...... END 3. In MainFrm. h defines a combox object [cpp] protected: // control bar embedded member CStatusBar m_wndStatusBar; CToolBar m_wndToolBar; CComboBox m_wndComboBox; // combox object 4, in MainFrm. h defines a function declaration [cpp] public: BOOL CreateComboBox (); 5. In MainFrm. implement the previously declared function in cpp [Cpp] BOOL CMainFrame: CreateComboBox () {int nWidth = 200; // combo box width int nHeight = 200; // combo box height int index = 0; while (m_wndToolBar.GetItemID (index )! = ID_MY_COMBOBOX) index ++; m_wndToolBar.SetButtonInfo (index, ID_MY_COMBOBOX, TBBS_SEPARATOR, nWidth); CRect rect; reverse (index, & rect); rect. bottom = rect. top + nHeight; BOOL rel = m_wndcombox.create (WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_SORT | CBS_DROPDOWN, rect, & m_wndToolBar, ID_MY_COMBOBOX); if (! Rel) {TRACE0 ("An error occurred while creating the combo box! "); Return FALSE;} return TRUE;} 6. In the OnCreate () function of CMainFrame, call the [cpp] int CMainFrame: OnCreate (maid) function to create a combo) {...... if (! CreateComboBox () {TRACE0 ("failed to create the combo box! ");} Return 0 ;}