订阅所有文章
文章搜索

高级搜索这是社么?这是顶尖最新推出的文章增强型搜索功能!
全网 本站
您现在的位置: 顶尖设计 >> IT学院 >> 编程开发 >> VC >> 文章正文

C++技巧之六

作者:cwxiao88…  来源:www.cwxiao888.com  点击  更新:2006-12-19 7:08:08  编辑: 画王w  字体

void main(void)

{
                    int i = 10;
                    printf("i: %d\n", i);
                    {
                    int i = 100;            /* This statement is fine since it is akin to defining
                                                                       a local function within the function. */
/* 此语句很精炼,
因为它在函数中定义了一局部函数的同族。*/
                    printf("i: %d\n", i);
                    }
                    printf("i: %d\n", i);
}
 

代码清单 6 CRecentFileListEx()函数

class CRecentFileListEx : public CRecentFileList
{
public:
    CRecentFileListEx(UINT nStart, LPCTSTR lpszSection,
        LPCTSTR lpszEntryFormat, int nSize,
        int nMaxDispLen = AFX_ABBREV_FILENAME_LEN):  
        CRecentFileList(nStart, lpszSection, lpszEntryFormat, nSize, nMaxDispLen)
    {
    }
                                         
    BOOL GetDisplayName(CString& strName, int nIndex,
        LPCTSTR lpszCurDir, int nCurDir, BOOL bAtLeastName = TRUE) const;
};
 
BOOL CRecentFileListDlgApp::InitInstance()
{
    ...
                
    LoadStdProfileSettings();  // Load standard INI file options (including MRU)
// 载入标准INI文件选项(包括MRU)
// Delete the m_pRecentFileList created in the LoadStdProfileSettings.
// 删除在LoadStdProfileSettings中创建的m_pRecentFileList
    delete m_pRecentFileList;
 
    // The nSize argument of the constructor is set to four because the  
    // LoadStdProfileSettings takes a default of four.  If you specify a  
    // different value for the nMaxMRU argument you need to change the
// nSize argument for the constructor call.
// 因为LoadStdProfileSettings 取默认值4,所以构造器的nSize参数设置为4
// 如果你为nMaxMRU参数指定不同的值,你需要为构造器呼叫而改变nSize参数。
    m_pRecentFileList = new CRecentFileListEx(0, FileSection, FileEntry, 4);
    m_pRecentFileList->ReadList();
 
    ...
}

  • 上一篇文章:

  • 下一篇文章:
  •      
    热门文章  
    推荐文章  
    相关文章    
     发表评论
      关于我们 | 联系我们 | 站点地图 | 广告投放 | 友情链接 | 在线留言 | 版权申明
    版权所有 © 2004-2007 顶尖设计(bobd.cn)
    未经授权禁止转载,摘编,复制本站内容或建立镜像. 沪ICP备05002835号