字体
第(2/5)页
关灯
   存书签 书架管理 返回目录
成设置注册数据库、载入标准设置(最近打开文件列表等)、注

    册文档模板等工作,其中注册文档模板过程中隐含地创建了主窗口。接着,处理命令行参数、

    显示窗口,然后返回、进入消息循环。在CHelloMFCApp 应用程序类中重载了CWinApp 的

    成员函数InitInstance,HelloMFC 程序中调用InitInstance()函数的代码如下:

    BOOL CHelloMFCApp::InitInstance()

    {

    AfxEnableControlContainer();

    // Standard initialization

    // If you are not using these features and wish to reduce the size

    // of your final executable, you should remove from the following

    枫叶文学网www.fywxw.com

    Visual C++ 6.0 程序设计从入门到精通

    ·20·

    // the specific initialization routines you do not need.

    #ifdef _AFXDLL

    Enable3dControls(); // Call this when using MFC in a shared DLL

    #else

    Enable3dControlsStatic(); // Call this when linking to MFC statically

    #endif

    // Change the registry key under which our settings are stored.

    // TODO: You should modify this string to be scomthing appropriate

    // such as the ncom of your company or organization.

    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    LoadStdProfileSettings(); // Load standard INI file options (including MRU)

    // Register the application’s doccomnt templates. Doccomnt templates

    // serve as the connection between doccomnts, frcom windows and views.

    CSingleDocTemplate* pDocTemplate;

    pDocTemplate = new CSingleDocTemplate(

    IDR_MAINFRAME,

    RUNTIME_CLASS(CHelloMFCDoc),

    RUNTIME_CLASS(CMainFrcom), // main SDI frc
上一页 目录 下一页