| 网站首页 | 新闻快报 | 软件教程 | 硬件教程 | 设计学院 | Q Q 专区 | 编程开发 | 网络安全 | 
您现在的位置: 浩扬网络 >> 编程开发 >> VC C编程 >> 教程正文
C++技巧之六
作者:不详 文章来源:安全中国 点击数: 更新时间:2006-8-4 20:07:17

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();
 
    ...
}
【教程录入:残梦    责任编辑:残梦 】
发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
网友评论:(评论内容只代表网友观点,与浩扬网络立场无关!)
热门文章

赞助商


| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 |