Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls


*pResult = 0;

CTreeCtrl *pTree = reinterpret_cast<CTreeCtrl
*>(GetDlgItem(IDC_CAR_TREE));
HTREEITEM hTree = pTree->GetSelectedItem();

CString ItemSelected;
CBitmap Bmp;

ItemSelected = pTree->GetItemText(hTree);

if( ItemSelected == "BH-733" )
{
m_Make.Format("%s", "Ford");
m_Model.Format("%s", "Focus");
m_Year = 2000;
m_Doors = 4;
m_Mileage = 72804;
m_Transmission = 1;
m_AC = TRUE;
m_AirBags = TRUE;
m_CruiseControl = FALSE;
m_Convertible = FALSE;
m_Cassette = FALSE;
m_CDPlayer = FALSE;
}
else if( ItemSelected == "HD-394" )
{
m_Make.Format("%s", "Ford");
m_Model.Format("%s", "F150");
m_Year = 2002;
m_Doors = 4;
m_Mileage = 28845;
m_Transmission = 0;
m_AC = TRUE;
m_AirBags = TRUE;
m_CruiseControl = FALSE;
m_Convertible = FALSE;
m_Cassette = TRUE;
m_CDPlayer = FALSE;
}
else if( ItemSelected == "SD-397" )
{
m_Make.Format("%s", "Daewoo");
m_Model.Format("%s", "Lanos");
m_Year = 2000;
m_Doors = 4;
m_Mileage = 94508;
m_Transmission = 1;
m_AC = TRUE;
m_AirBags = TRUE;
m_CruiseControl = FALSE;
m_Convertible = FALSE;
m_Cassette = TRUE;
m_CDPlayer = FALSE;
}
else if( ItemSelected == "PD-304" )
{
m_Make.Format("%s", "Mercury");
Free download pdf