MFC中的CMap类使用

来源:互联网 发布:淘宝女装客服培训 编辑:程序博客网 时间:2024/06/05 08:23
    #include <afxtempl.h>    CMap<CString,LPCTSTR,CString,LPCTSTR>my_Map;    CString strKey   = _T("");    CString strValue = _T("");    my_Map.SetAt("1","hello");//添加元素    CString pLook;    my_Map.Lookup("1",pLook);//查找元素    ShowMessage(pLook.GetBuffer(pLook.GetLength()));    int c = my_Map.GetCount();    my_Map.RemoveAll();//删除所有元素    bool re = my_Map.RemoveKey("1");//删除其中一个元素    c = my_Map.GetCount();//获取元素个数

原创粉丝点击