我知道有多种方法:
SetWindowText
SetWindowTitle可我不知在哪里改比较合适:我想在主窗口标题中不出现子窗口的标题!!!
我在几个地方改了,可子窗口一最大化,标题就变了,
论坛中有文章说在CChildFram的虚函数OnUpdateTitle中修改,可根本没有啊,
那是COle..的虚函数啊!

解决方案 »

  1.   

    BOOL CMdiDoc::OnNewDocument()
    里面
    SetTitle("");
      

  2.   

    to foxmail(萧遥),
    是子窗体最大化时,主窗体标题改变了啊,根本不会触发OnNewDocument的!
      

  3.   

    解决的问题在于一个鲜为人知的未归档的虚函数:CFrameWnd::OnUpdateFrameTitle().每个CFrameWnd派生类都可以重载该函数,这样就能够定制显示的框架标题。每当框架窗口需要设置它的标题时,MFC就调用该函数。
      范例如下:
    在CChildFrame的类定义中加入如下函数声明:
    class CChildFrame:public CMDIChildWnd
    {
    ...
    virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
    ...
    };//OnUpdateFrameTitle的实现
    void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
    {
    //1-首先调用默认函数
    CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
    //2-现在根据需要调整标题
    CString strMyTitle = "MyTitle";
    //原有标题
    //CString strInitialTitle;
    //GetWindowTitle(strInitialTitle);
    SetWindowText(strMyTitle);
    }
      

  4.   

    主个很简单,只要修改childframe的属性去FWS_ADDTOTITLE就行了。
    在CChildFrame::PreCreateWindows中加入
     cs.style &= ~FWS_ADDTOTITLE;
      

  5.   

    去掉子窗口的FWS_ADDTOTITLE属性
      

  6.   

    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs if( !CMDIChildWnd::PreCreateWindow(cs) )
    return FALSE; cs.style &= ~FWS_ADDTOTITLE;
    return TRUE;
    }BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    if( !CMDIFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
    cs.style &= ~FWS_ADDTOTITLE;
    return TRUE;
    }
    BOOL CMdiApp::InitInstance()
    {
    AfxEnableControlContainer();
             
             ............ pMainFrame->SetWindowText("Hello");
    return TRUE;
    }