Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MRU in a dialog box app

MRU in a dialog box app

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Filomela
    wrote on last edited by
    #1

    How can I add files to MRU in a dialog box app? I tried to override OnOpenRecentFile and OnUpdateRecentFile which i have found in appui.cpp but nothing happens.

    R 1 Reply Last reply
    0
    • F Filomela

      How can I add files to MRU in a dialog box app? I tried to override OnOpenRecentFile and OnUpdateRecentFile which i have found in appui.cpp but nothing happens.

      R Offline
      R Offline
      Robert A T Kaldy
      wrote on last edited by
      #2

      Have you tried CRecentFileList class? (see MSDN for details) Robert-Antonio "CRAY is the only computer, which runs an endless loop in just 4 hours"

      F 1 Reply Last reply
      0
      • R Robert A T Kaldy

        Have you tried CRecentFileList class? (see MSDN for details) Robert-Antonio "CRAY is the only computer, which runs an endless loop in just 4 hours"

        F Offline
        F Offline
        Filomela
        wrote on last edited by
        #3

        Yes.I have done a key in Registry and another key called Recent File List and there are all my 5 MRU, but i want to put them in a menu to appear also there .I have put ID_FILE_MRU_FILE1 but MRU don't appear.This is my problem. Thanks.

        R 1 Reply Last reply
        0
        • F Filomela

          Yes.I have done a key in Registry and another key called Recent File List and there are all my 5 MRU, but i want to put them in a menu to appear also there .I have put ID_FILE_MRU_FILE1 but MRU don't appear.This is my problem. Thanks.

          R Offline
          R Offline
          Robert A T Kaldy
          wrote on last edited by
          #4

          Handle an UPDATE_COMMAND_UI message for the ID_FILE_MRU_FILE1 menu item:

          void CMainFrame::OnUpdateFileMruFile1(CCmdUI* pCmdUI)
          {
          m_MRU.UpdateMenu(pCmdUI);
          }

          where m_MRU is your CRecentFileList object. Robert-Antonio "Friends come and leave, but teddybears stay in forever."

          F 2 Replies Last reply
          0
          • R Robert A T Kaldy

            Handle an UPDATE_COMMAND_UI message for the ID_FILE_MRU_FILE1 menu item:

            void CMainFrame::OnUpdateFileMruFile1(CCmdUI* pCmdUI)
            {
            m_MRU.UpdateMenu(pCmdUI);
            }

            where m_MRU is your CRecentFileList object. Robert-Antonio "Friends come and leave, but teddybears stay in forever."

            F Offline
            F Offline
            Filomela
            wrote on last edited by
            #5

            I have a dialog box, not a doc/view architecture.

            R 1 Reply Last reply
            0
            • F Filomela

              I have a dialog box, not a doc/view architecture.

              R Offline
              R Offline
              Robert A T Kaldy
              wrote on last edited by
              #6

              This solution isn't dependent on doc/view. If you want to add MRU to dialog box, use simply CYourDialog instead of CMainFrame Robert-Antonio "Love without sex is like a fish without antlers"

              1 Reply Last reply
              0
              • R Robert A T Kaldy

                Handle an UPDATE_COMMAND_UI message for the ID_FILE_MRU_FILE1 menu item:

                void CMainFrame::OnUpdateFileMruFile1(CCmdUI* pCmdUI)
                {
                m_MRU.UpdateMenu(pCmdUI);
                }

                where m_MRU is your CRecentFileList object. Robert-Antonio "Friends come and leave, but teddybears stay in forever."

                F Offline
                F Offline
                Filomela
                wrote on last edited by
                #7

                Thanks a lot.It works.But I have another problem. When I open the first file from MRU menu it works,but if i want to open the rest of 4 files I get an assert:appui.cpp line 130,ASSERT(m_pRecentFileList != NULL); But I don't have anything with BOOL CWinApp::OnOpenRecentFile(UINT nID). I did my own function. void CMyRtfDlg::OnFileMruFile1() { OnOpenRecentFile(ID_FILE_MRU_FILE1); } // added on 22 Apr 2004 void CMyRtfDlg::OnUpdateFileMruFile1(CCmdUI* pCmdUI) { m_pMRU->UpdateMenu(pCmdUI); } // @added on 22 Apr 2004 from appui.cpp // @for MRU BOOL CMyRtfDlg::OnOpenRecentFile(UINT nID) { ASSERT(m_pMRU!= NULL); ASSERT(nID >= ID_FILE_MRU_FILE1); ASSERT(nID < ID_FILE_MRU_FILE1 + (UINT)m_pMRU->GetSize()); int nIndex = nID - ID_FILE_MRU_FILE1; ASSERT((*m_pMRU)[nIndex].GetLength() != 0); TRACE2("MRU: open file (%d) '%s'.\n", (nIndex) + 1, (LPCTSTR)(*m_pMRU)[nIndex]); OnFileOpen((*m_pMRU)[nIndex]); return TRUE; }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups