学了VC四五年了,但至今对链表问题的认识还很模糊。更不知什么时候需要建立链表和怎么去建立链表。望高手指点,最好结合实例说明。谢谢!!
解决方案 »
- 怎样将button与想要实现的功能关联起来?
- [DShow]如何创建一个空的 Render?
- 文本框如何实现换行?
- user breakpoint called from code at 0x....,刚刚我程序还好好的,怎么一下就出了这个问题?但Release版本就不会有这个问题?请教,高分
- 急救:用MFC写控件,怎样才能在控件中自己调整自己的大小,在线等,解决立马给分
- 使用DOM创建文档对象的时候,怎么指定文档类型?
- 如何在mfc里使用winsock2的函数?
- 怎样让启动画面显示完之后再显示程序的主框架?
- 对话框中WebBrowser怎么加入MouseMove事件?
- 如何判断串口是否被监控
- 为什么int和unsigned移位的结果不同?
- 英文版XP(不允许安装中文支持)下怎样让中文版系统下开发的中文VC程序界面显示汉字?
class CClientInfo : public CObject
{
DECLARE_SERIAL(CClientInfo)
public:
HWND m_hWnd;//窗口句柄
sockaddr_in m_Cmddst;
sockaddr_in m_AVdst;
BOOL bMain;
short UID;
int m_uDataRcv;
int m_iZeroCount;
int m_ChatNo;
CString m_szIP;
CClientInfo();
virtual ~CClientInfo();};
typedef CTypedPtrList<CObList, CClientInfo*> CClientInfoList;
typedef CTypedPtrList<CObList, CClientInfo*> CClientInfoList;谁能解释一下为什么要这样写?怎么调用它?
CClientInfoList m_ClientInfoList;
POSITION pos;
if (m_ClientInfoList.GetCount()!=0)
{
for( pos = m_ClientInfoList.GetHeadPosition(); pos != NULL; )
{
CClientInfo *pClientInfo=m_ClientInfoList.GetAt(pos);
.................
m_ClientInfoList.GetNext(pos);
}// end of for
}
但是我看到有些代码直接写成这样CPtrList m_connectionList;然后这样调用
for(POSITION pos = m_connectionList.GetHeadPosition ();pos!=NULL;)
{
CClientSocket* pSocket = (CClientSocket*)m_connectionList.GetNext (pos);
..............
}
typedef CTypedPtrList <CObList, CClientInfo*> CClientInfoList与CPtrList m_connectionList写有什么作用?谢谢!!
就是封装成CClientInfo的容器对象么。是一个链表
是个继承的模板容器吧