CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

看不懂那位高手帮忙写一下注解

楼主yzs001()2006-06-01 12:38:32 在 VC/MFC / 基础类 提问

void   CPageFileType::InitListCtrl()  
  {  
  m_listCtrlFileType.DeleteAllItems();  
   
  //   Get   the   initialize   file   type  
  const   int SIZE_PATH   =   256;  
  const   int SIZE_VALUE   =   512;  
  const   int SIZE_FILE   =   1024;  
  const   TCHAR* INI_FILE   =   _T(   "\\Set.ini"   );  
  const   TCHAR* SECTION_FILETYPE   =   _T(   "FileType"   );  
  const   TCHAR* SEC_FILETYPESEL   =   _T(   "FileTypeSelect"   );  
   
  TCHAR   strPath[   SIZE_PATH   ];  
  VERIFY(   GetCurrentDirectory(   SIZE_PATH,   strPath   )   );  
   
  CString strIniPath   =   strPath;  
  strIniPath   +=   INI_FILE;  
   
  //   Get   all   string   key   name   in   the   FileType   section   in   the   Set.ini   file.  
  TCHAR   strKeyName[   SIZE_FILE   ];  
  int   nLength   =   GetPrivateProfileString(   SECTION_FILETYPE,   NULL,   NULL,   strKeyName,   SIZE_FILE,   strIniPath   );  
  ASSERT(   nLength   <=   SIZE_FILE   -   1   );  
   
  //   Get   the   first   string   key   name's   length  
  CString   strName;  
  CString   strValue;  
   
  for   (   int   i   =   0;   i   <   nLength;   i++   )  
  {  
  if   (   strKeyName[   i   ]   ==   '\0'   )  
  {  
  GetPrivateProfileString(   SECTION_FILETYPE,   strName,   NULL,   \  
  strValue.GetBuffer(   SIZE_VALUE   ),   SIZE_VALUE,   strIniPath   );  
  strValue.ReleaseBuffer();  
  int   nFlag   =   GetPrivateProfileInt(   SEC_FILETYPESEL,   strName,   0,   strIniPath   );  
   
  TRACE1(   "%d\t",   nFlag   );  
  TRACE(   strName   +   "\t"   +   strValue   +   "\n"   );  
   
  InsertListItem(   &   m_listCtrlFileType,   strName,   strValue,   nFlag   );  
   
  strValue   =   _T(   ""   );  
  strName   =   _T(   ""   );  
  }  
  else  
  {  
  strName   +=   strKeyName[   i   ];  
  }  
  }  
  }  
   
  void   CPageFileType::InsertListItem(   CListCtrl*   pListCtrl,   CString   strName,   CString   strValue,   int   nFlag   )  
  {  
  if   (   strName.IsEmpty()   ||   strValue.IsEmpty()   ||   (   pListCtrl   ==   NULL   )   )  
  return;  
  ASSERT_VALID(   pListCtrl   );  
   
  LVITEM   lvi;  
   
  lvi.mask =   LVIF_IMAGE   |   LVIF_TEXT;  
  lvi.iItem =   0;  
  lvi.iSubItem =   0;  
  lvi.pszText =   (   LPTSTR   )   (   LPCTSTR   )   strName;  
  lvi.iImage =   0;  
   
  pListCtrl->InsertItem(   &   lvi   );  
   
  lvi.iSubItem =   1;  
  lvi.pszText =   (   LPTSTR   )   (   LPCTSTR   )   strValue;  
   
  pListCtrl->SetItem(   &   lvi   );  
  pListCtrl->SetCheck(   0,   nFlag   );  
  } 问题点数:20、回复次数:6Top

1 楼xiao_fang(frank)回复于 2006-06-01 12:59:12 得分 0

读取配置文件,插入到列表中Top

2 楼yzs001()回复于 2006-06-01 16:14:50 得分 0

请问在那里读取结束  
  我想在读取结束后显示一条命令,  
  比如读取结束显示  
  MessageBox(   "读取结束",   "我的程序",   MB_ICONINFORMATION   );Top

3 楼abuseyoudna1981()回复于 2006-06-01 16:18:32 得分 0

在你函数结尾处加不就行了吗?我晕死.Top

4 楼yzs001()回复于 2006-06-01 17:09:09 得分 0

我在函数结尾处加了,但是列表框有几行它就提示我几次!  
  比如列表框有3行它就提示我3次,  
  要是列表框有5行它就提示我5次  
   
  我的意识是让整个列表框全部加载完成后提示我1次  
  有专家能帮我吗?Top

5 楼yzs001()回复于 2006-06-01 19:03:43 得分 0

有专家能帮我吗?Top

6 楼iccke1()回复于 2006-06-01 19:10:31 得分 20

那是你没有加到最后,你加到  
  else  
  {  
  strName   +=   strKeyName[   i   ];  
  }  
  }  
  MessageBox(   "读取结束",   "我的程序",   MB_ICONINFORMATION   );  
  }  
  就好了Top

相关问题

关键词

得分解答快速导航

  • 帖主:yzs001
  • iccke1

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo