Error in code that inserts strings into MFC CComboBox—is it a memory leak?
In Visual Studio 2012, I I created an MFC dialog project. Then I dropped a
combobox from the toolbox onto my dialog. I set this combobox's variable
to mybox, then added some strings to it in OnInitDialog:
BOOL CAlcorAM80WriterV1Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// IDM_ABOUTBOX
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
// TODO:
mybox.InsertString(0, _T("one"));
mybox.InsertString(0, _T("two"));
mybox.InsertString(0, _T("three"));
return TRUE;
}
But when I restart the application, it show the error message:
{135} client block at 0x00504750, subtype c0, 204 bytes long.
a CObject object at $00504750, 204 bytes long
Anyone know what happened?
No comments:
Post a Comment