HICON m_hIcon; 在MainFrm的OnCreate()里 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon cs.style&=~FWS_ADDTOTITLE; m_strTitle="冰冻一亿年";
初使化列表视图
void CClientView::ListView () { CListCtrl& ListCtrl = GetListCtrl(); //创建图象列表 // m_SmallImageList.Create(IDB_SMALLICONS, 16, 1, RGB(255, 255, 255)); // m_SmallImageList.SetOverlayImage(1, 1); // ListCtrl.SetImageList(&m_SmallImageList, LVSIL_SMALL); //设置列表视图类型 ListCtrl.SetExtendedStyle(ListCtrl.GetExtendedStyle()|LVS_EX_FLATSB|LVS_EX_SUBITEMIMAGES|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_REPORT); DWORD dwStyle = GetWindowLong(ListCtrl.GetSafeHwnd(),GWL_STYLE); dwStyle &= ~LVS_TYPEMASK; dwStyle |= LVS_REPORT; SetWindowLong(ListCtrl.GetSafeHwnd(),GWL_STYLE,dwStyle); SetRedraw(TRUE); Invalidate(); //插入列 ListCtrl.InsertColumn(0, "第一列", LVCFMT_LEFT, 75); ListCtrl.InsertColumn(1, "第二列", LVCFMT_LEFT, 150); ListCtrl.InsertColumn(2, "第三列", LVCFMT_LEFT, 50); ListCtrl.InsertColumn(3, "第四列", LVCFMT_LEFT, 125); ListCtrl.InsertColumn(4, "第五列", LVCFMT_LEFT, 75); }
视图窗口大小和位置
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs int nWidth=GetSystemMetrics(SM_CXSCREEN); //屏幕宽度 int nHeight=GetSystemMetrics(SM_CYSCREEN); //屏幕高度 cs.cx =nWidth*7/10; cs.cy =nHeight*6/10; cs.x=(nWidth-cs.cx)/2; cs.y=(nHeight-cs.cy)/2;
select 模型
FD_SET writefd; FD_SET readfd; FD_ZERO(&writefd); FD_ZERO(&readfd); FD_SET(sock,&writefd); FD_SET(sock,&readfd); while(TRUE) { int nRet=0; nRet=select(0, &writefd, &readfd, NULL, NULL); if(SOCKET_ERROR==nRet) { AfxMessageBox("Select错误"); } else if(nRet>0) { if(FD_ISSET(sock,&readfd)) { AfxMessageBox("readfd启动"); } if(FD_ISSET(sock,&writefd)) { AfxMessageBox("writefd启动"); } } }
m_tree.InsertItem(buff,TVI_ROOT,TVI_LAST );
出错