CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2005
    Posts
    40

    Determine if any documents open in MDI

    Hi gurus,
    I'm new to writing a MDI program and was wondering how to determine if any documents are currently open from CMainFrame.
    I need this because I am trying to disable a tool bar when the mainframe window is empty.

    Also, which windows message do I need to use to know when the active document has changed?

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Determine if any documents open in MDI

    Add an ON_UPDATE_COMMAND_UI handler for the toolbar item you want to disable and in the handler, do this:
    Code:
    void CMainFrame::OnUpdateYourToolBarButtonID(CCmdUI* pCmdUI)
    {
    	pCmdUI->Enable(NULL != MDIGetActive());
    }

  3. #3
    Join Date
    Oct 2000
    Location
    India
    Posts
    4,620

    Thumbs up Re: Determine if any documents open in MDI

    Hi,

    After u change your document's content, call "UpdateAllViews".
    All luck and have a great day.

    Regards,
    V.Girish

    Visit www.geocities.com/contactgirish for Source code, Tutorials, FAQs and Downloads.

  4. #4
    Join Date
    Nov 2005
    Posts
    40

    Re: Determine if any documents open in MDI

    Thanks a lot. works like a dream.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured