CFileItemList itemList; itemList.AddFile(_T("C:\\Test\\file1.txt")); itemList.AddFile(_T("C:\\Test\\file2.txt")); itemList.SetLabel(0, _T("First File")); itemList.SetLabel(1, _T("Second File"));
for (int i = 0; i < itemList.GetCount(); i++) { CString label = itemList.GetFileName(i); label += _T(" ("); label += itemList.GetFileSize(i); label += _T(")"); itemList.SetLabel(i, label); }In this example, we iterate through all the items in the list and construct a label for each item that includes the file name and size. We then set this label using SetLabel. Package Library: MFC (Microsoft Foundation Classes) library in C++