我想询问如何在启动画面消失之前让主界面里的菜单全部是灰色,在启动画面消失之后菜单才可以是可用的??

解决方案 »

  1.   

    你需要映射所有菜单的WM_UPDATE_COMMAND_UI消息,在其处理函数中增加对启动窗口是否结束的判断void CMyView::OnUpdateMyMenu(CCmdUI* pCmdUI)
    {
         if(!FinishedStarting){
           pCmdUI->Enable(FALSE);
           return;
         };
         //这里加其他代码
    }
      

  2.   

    这是CMyView的代码请高手具体指点一下如何在启动画面消失之前让主界面里的菜单全部是灰色,在启动画面消失之后菜单才可以是可用的
    // 数据结构演示系统View.cpp : implementation of the CMyView class
    //#include "stdafx.h"
    #include "数据结构演示系统.h"#include "数据结构演示系统Doc.h"
    #include "数据结构演示系统View.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CMyViewIMPLEMENT_DYNCREATE(CMyView, CView)BEGIN_MESSAGE_MAP(CMyView, CView)
    //{{AFX_MSG_MAP(CMyView)
    // NOTE - the ClassWizard will add and remove mapping macros here.
    //    DO NOT EDIT what you see in these blocks of generated code!
    //}}AFX_MSG_MAP
    // Standard printing commands
    ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CMyView construction/destructionCMyView::CMyView()
    {
    // TODO: add construction code here}CMyView::~CMyView()
    {
    }BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs return CView::PreCreateWindow(cs);
    }/////////////////////////////////////////////////////////////////////////////
    // CMyView drawingvoid CMyView::OnDraw(CDC* pDC)
    {
    CMyDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here
    }/////////////////////////////////////////////////////////////////////////////
    // CMyView printingBOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
    {
    // default preparation
    return DoPreparePrinting(pInfo);
    }void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
    {
    // TODO: add extra initialization before printing
    }void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
    {
    // TODO: add cleanup after printing
    }/////////////////////////////////////////////////////////////////////////////
    // CMyView diagnostics#ifdef _DEBUG
    void CMyView::AssertValid() const
    {
    CView::AssertValid();
    }void CMyView::Dump(CDumpContext& dc) const
    {
    CView::Dump(dc);
    }CMyDoc* CMyView::GetDocument() // non-debug version is inline
    {
    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
    return (CMyDoc*)m_pDocument;
    }
    #endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
    // CMyView message handlers
    菜单的选项需要设置吗?