visual-studio-2008visual-c++mfc

MFC CTabCtrl how to add a close button for a tab


I'm using a CTabCtrl in my MFC Dialog Based application. The problem I'm having is that I'm adding tabs in runtime and I can't add a close button for the tabs to close. How can I achieve this? Can't I achieve this using CTabCtrl? Is there any other way to get this done?


Solution

  • If you use CMFCTabCtrl instead, you could call the CMFCTabCtrl::EnableActiveTabCloseButton method, which would add the close button to the active tab.