Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
HTREEITEM hItem, hCar;
hItem = m_CarTree.InsertItem("Car Listing", TVI_ROOT);
hCar = m_CarTree.InsertItem("Economy", hItem);
m_CarTree.InsertItem("BH-733", hCar);
m_CarTree.InsertItem("SD-397", hCar);
m_CarTree.InsertItem("JU-538", hCar);
m_CarTree.InsertItem("DI-285", hCar);
m_CarTree.InsertItem("AK-830", hCar);
hCar = m_CarTree.InsertItem("Compact", hItem);
m_CarTree.InsertItem("HG-490", hCar);
m_CarTree.InsertItem("PE-473", hCar);
hCar = m_CarTree.InsertItem("Standard", hItem);
m_CarTree.InsertItem("SO-398", hCar);
m_CarTree.InsertItem("DF-438", hCar);
m_CarTree.InsertItem("IS-833", hCar);
hCar = m_CarTree.InsertItem("Full Size", hItem);
m_CarTree.InsertItem("PD-304", hCar);
hCar = m_CarTree.InsertItem("Mini Van", hItem);
m_CarTree.InsertItem("ID-497", hCar);
m_CarTree.InsertItem("RU-304", hCar);
m_CarTree.InsertItem("DK-905", hCar);
hCar = m_CarTree.InsertItem("SUV", hItem);
m_CarTree.InsertItem("FE-948", hCar);
m_CarTree.InsertItem("AD-940", hCar);
hCar = m_CarTree.InsertItem("Truck", hItem);
m_CarTree.InsertItem("HD-394", hCar);
return TRUE; // return TRUE unless you set the focus to a control
}
- Execute the program to test the tree control
- Close it and return to MSVC