datalistbox.cpp

来自「IO函数调用测试」· C++ 代码 · 共 59 行

CPP
59
字号
// DataListBox.cpp : implementation file
//

#include "stdafx.h"
#include "IOExplorer.h"
#include "DataListBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDataListBox

CDataListBox::CDataListBox()
{
}

CDataListBox::~CDataListBox()
{
}


BEGIN_MESSAGE_MAP(CDataListBox, CListBox)
	//{{AFX_MSG_MAP(CDataListBox)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDataListBox message handlers

/****************************************************************************
*                         CDataListBox::ResetContent
* Result: void
*       
* Effect: 
*       Before resetting the content, deletes all the itemdata values
****************************************************************************/

void CDataListBox::ResetContent()
    {
     for(int i = 0; i < GetCount(); i++)
        { /* delete all */
	 LPTSTR p = (LPTSTR)GetItemDataPtr(i);
	 if(p != NULL)
	    delete [] p;
	} /* delete all */
     CListBox::ResetContent();
    }

void CDataListBox::OnDestroy() 
{
 	ResetContent();
	CListBox::OnDestroy();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?