我现在用向导生成了一个SDI程序,是用的FormView,背景就是一个对话框嘛,现在我新建了一个对话框,也是Formview类的,在背景对话框上放一个按钮,我想实现按下这个按钮后,背景就换成第二个对话框了。。请问怎么实现,详细点好吗?谢谢大家了。

解决方案 »

  1.   

    加入“新建的Formview”与doc的关联代码;
    doc->AddView(view指针);
      

  2.   

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CEISSERVERDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CMainFormView)); CWinApp *theApp = AfxGetApp();
    theApp->m_pMainWnd->ShowWindow(SW_HIDE);
    theApp->AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    theApp->ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
    if (!theApp->ProcessShellCommand(cmdInfo))
    return ; // The one and only window has been initialized, so show and update it.
    theApp->m_pMainWnd->ShowWindow(SW_SHOW);
    theApp->m_pMainWnd->UpdateWindow();我在OnButton1()里面这第写的。结果弹出来一个小框框,先喊我选择一个模版,然后再弹了一个全新的SDI出来 。。