文件树控件和获取驱动信息功能
然后添加上查看文件信息的按钮
双击这个按钮添加上如下代码
void CRemoteClientDlg::OnBnClickedBtnFileinfo()
{int ret = SendCommandPacket(1);if (ret == -1) {AfxMessageBox(_T("命令处理失败!!!"));return;}ClientSocket* pClient = ClientSocket::getInstance();std::string drivers = pClient->GetPacket().strData;std::string dr;m_Tree.DeleteAllItems(); //删除树视图控件中的所有项for (size_t i = 0; i < drivers.size(); i++) {if (drivers[i] == ',') {dr += ":";m_Tree.InsertItem(dr.c_str(),TVI_ROOT,TVI_LAST);dr.clear();continue;}dr += drivers[i];}
}
然后给Tree Control添加上变量 m_Tree
InsertItem()
HTREEITEM InsertItem(LPCTSTR lpszItem,HTREEITEM hParent = TVI_ROOT,HTREEITEM hInsertAfter = TVI_LAST);