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. CDocManager::DoPromptFileName(...) error

CDocManager::DoPromptFileName(...) error

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
6 Posts 3 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.
  • Y Offline
    Y Offline
    yellowine
    wrote on last edited by
    #1

    I used Visual C++ 2005 to generate an MFC doc-view sample application. I got an strange error message when I try to open an previously save file in MFC in a static library. I have traced the problem and it was the codes in MFC provided docmgr.cpp below which caused the problem: BOOL CDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate) { CFileDialog dlgFile(bOpenFileDialog, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL, 0); CString title; VERIFY(title.LoadString(nIDSTitle)); dlgFile.m_ofn.Flags |= lFlags; ... } The VERIFY(title.LoadString(nIDSTitle)) statement gives VERIFY's error. However, if I compiled the application in "Use MFC in a shared DLL". Then compile and build it, it can work without any problem! Anyone know what the problem is?

    K D 2 Replies Last reply
    0
    • Y yellowine

      I used Visual C++ 2005 to generate an MFC doc-view sample application. I got an strange error message when I try to open an previously save file in MFC in a static library. I have traced the problem and it was the codes in MFC provided docmgr.cpp below which caused the problem: BOOL CDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate) { CFileDialog dlgFile(bOpenFileDialog, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL, 0); CString title; VERIFY(title.LoadString(nIDSTitle)); dlgFile.m_ofn.Flags |= lFlags; ... } The VERIFY(title.LoadString(nIDSTitle)) statement gives VERIFY's error. However, if I compiled the application in "Use MFC in a shared DLL". Then compile and build it, it can work without any problem! Anyone know what the problem is?

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      looks like the string id isnt representing a string in your resource. Make a "Rebuild all" and look whether the id is a valid string.

      Greetings from Germany

      Y 1 Reply Last reply
      0
      • Y yellowine

        I used Visual C++ 2005 to generate an MFC doc-view sample application. I got an strange error message when I try to open an previously save file in MFC in a static library. I have traced the problem and it was the codes in MFC provided docmgr.cpp below which caused the problem: BOOL CDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate) { CFileDialog dlgFile(bOpenFileDialog, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL, 0); CString title; VERIFY(title.LoadString(nIDSTitle)); dlgFile.m_ofn.Flags |= lFlags; ... } The VERIFY(title.LoadString(nIDSTitle)) statement gives VERIFY's error. However, if I compiled the application in "Use MFC in a shared DLL". Then compile and build it, it can work without any problem! Anyone know what the problem is?

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        yellowine wrote:

        Anyone know what the problem is?

        Have you set a breakpoint on that statement to see what the value of nIDSTitle is, or how about stepping into the LoadString() method to see what it is returning?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        Y 1 Reply Last reply
        0
        • K KarstenK

          looks like the string id isnt representing a string in your resource. Make a "Rebuild all" and look whether the id is a valid string.

          Greetings from Germany

          Y Offline
          Y Offline
          yellowine
          wrote on last edited by
          #4

          I have tried rebuild all and did not work...

          1 Reply Last reply
          0
          • D David Crow

            yellowine wrote:

            Anyone know what the problem is?

            Have you set a breakpoint on that statement to see what the value of nIDSTitle is, or how about stepping into the LoadString() method to see what it is returning?

            "Love people and use things, not love things and use people." - Unknown

            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

            Y Offline
            Y Offline
            yellowine
            wrote on last edited by
            #5

            Tried step into debug, nIDSTitle seems to be the standard AFX_IDS_OPENFILE (61440). It seems the standard AFX_IDA_... are defined in afxres.rc, how how comes this file is not included in the project. Therefore it seems to be related to project setting to solve it. Just dunno. Any idea?

            K 1 Reply Last reply
            0
            • Y yellowine

              Tried step into debug, nIDSTitle seems to be the standard AFX_IDS_OPENFILE (61440). It seems the standard AFX_IDA_... are defined in afxres.rc, how how comes this file is not included in the project. Therefore it seems to be related to project setting to solve it. Just dunno. Any idea?

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              MFC wants that you assign a string to AFX_IDS_OPENFILE X|

              Greetings from Germany

              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