void CListBoxOLEDragAndDropSampleDlg::OnLbnSelchangeList1() { int Index = m_ListBox.GetCurSel(); m_Selected.SetWindowText(""); if (Index != LB_ERR) { CString Text; m_ListBox.GetText(Index,Text); m_Selected.SetWindowText(Text); int x; x++; char buf[20]; itoa(x, buf, 20); m_Test.SetWindowText(buf); } }