Provides the functionality of a Windows combo box.
2025-11-06
Written by: xiaobin
Use the wizard to create a dialog-based MFC application.
All settings are default values.

First, declare the variable in the header file(MFCApplication1Dlg.h); then, add the implementation in the OnInit() event.
protected:
CMFCTabCtrl m_wndTab;
CEdit m_wnd1;
CEdit m_wnd2;
CRect rectTab;
GetDlgItem(IDC_STATIC)->GetWindowRect(&rectTab);
ScreenToClient(&rectTab);
// CMFCTabCtrl Create
m_wndTab.Create(CMFCTabCtrl::STYLE_3D, rectTab, this, 1, CMFCTabCtrl::LOCATION_TOP, TRUE);
// CEdit Create
// 2 simple text
m_wnd1.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 100, 100), &m_wndTab, 1);
m_wnd1.SetWindowText(_T("Edit 1"));
m_wnd2.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 2);
m_wnd2.SetWindowText(_T("Edit 2"));
// add caption
m_wndTab.AddTab(&m_wnd1, _T("One"), 0, TRUE);
m_wndTab.AddTab(&m_wnd2, _T("Two"), 0, FALSE);