一个普通的对话框,除了OK按钮之外没有任何控件DoModal()顺利启动对话框并显示可加上Rich Edit后,为什么就不能显示对话框了?谢谢给予指点!

解决方案 »

  1.   

    在你的应用程序类的InitInstance()函数中如此这般就可以了BOOL CSecuritylibApp::InitInstance()
    {
    AfxEnableControlContainer(); AfxInitRichEdit();    // 加上这句就可以了
    #ifdef _AFXDLL
    Enable3dControls();
    #else
    Enable3dControlsStatic();
    #endif CSecuritylibDlg dlg;
    m_pMainWnd = &dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
    } return FALSE;
    }
      

  2.   

    为什么对于rich edit这种控件必须预先如此处理,而其他控件加上就可以正确显示呢?
      

  3.   

    要用到容器,也就是ole编程,不过你还可以直接在app wizard中选项选,也可以按照lingfeng8888(棱枫)的方法。
      

  4.   

    lingfeng8888(棱枫) 说的没错。
    至于为什么可能这种控健比较特别,需要初始化很多东西,
    如果什么程序都自动初始化,就显得有些浪费了,
    可能也许是别的原因。