怎样使用cmap,怎样用new申请个cmap空间,写出示例,谢谢 怎样使用cmap,怎样用new申请个cmap空间,写出示例,需要什么头文件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CMap<UINT, UINT, CString, CString> *m_map1;m_map1 = new CMap<UINT, UINT, CString, CString>;m_map1->SetAt(0x01,"001") ;m_map1->SetAt(0x02,"002") ;m_map1->SetAt(0x03,"003") ;CString sValue;m_map1->Lookup(0x01,sValue);delete m_map1;建议,直接在堆上面申请更简单头文件#include <afxtempl.h>#include <afxcoll.h> CMap<int,int,CPoint,CPoint> myMap; // Add 10 elements to the map. for (int i=0;i < 10;i++) myMap.SetAt( i, CPoint(i, i) ); // Remove the elements with even key values. POSITION pos = myMap.GetStartPosition(); int nKey; CPoint pt; while (pos != NULL) { myMap.GetNextAssoc( pos, nKey, pt ); if ((nKey%2) == 0) myMap.RemoveKey( nKey ); }#ifdef _DEBUG afxDump.SetDepth( 1 ); afxDump << "myMap: " << &myMap << "\n";#endif 救命啊~~~~~~~~ 在共享DLL中使用MFC问题? ChatRoomClient\ChatRoomClientDlg.cpp(284) : fatal error C1004: unexpected end of file found 一个简单的问题。 问大家一个问题,STEVENS的书中的那些命令在WINDOWS 不可以吗?为什么? 帮助文件问题! VC/MFC做应用级软件,比如数据库,是否合适? _T()是干什么用的? socket如何传递结构? 无标题对话框上的视图的滚动条 怎在MFC对话框中嵌入网页? 知道3个.wmv文件的路径,如何把这3个文件都加入剪贴板?
m_map1 = new CMap<UINT, UINT, CString, CString>;
m_map1->SetAt(0x01,"001") ;
m_map1->SetAt(0x02,"002") ;
m_map1->SetAt(0x03,"003") ;CString sValue;
m_map1->Lookup(0x01,sValue);delete m_map1;建议,直接在堆上面申请更简单
头文件
#include <afxtempl.h>
#include <afxcoll.h>
for (int i=0;i < 10;i++)
myMap.SetAt( i, CPoint(i, i) ); // Remove the elements with even key values.
POSITION pos = myMap.GetStartPosition();
int nKey;
CPoint pt;
while (pos != NULL)
{
myMap.GetNextAssoc( pos, nKey, pt ); if ((nKey%2) == 0)
myMap.RemoveKey( nKey );
}#ifdef _DEBUG
afxDump.SetDepth( 1 );
afxDump << "myMap: " << &myMap << "\n";
#endif