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. Managed C++/CLI
  4. Project Converted From VS2003 to VS2008, get exception when call dialog.doModal

Project Converted From VS2003 to VS2008, get exception when call dialog.doModal

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++tutorialquestion
7 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.
  • A Offline
    A Offline
    Andraw Tang
    wrote on last edited by
    #1

    Hi, dear all, I have a C++ project created in VS2003, now I convert it to VS2008, after fix some compile errors and setting change, it compiles ok and can be started. This project application is an EXE file, not DLL file. When I create a dialog object and call dlg.doModal(), get afxwin1.inl ASSERT error in AfxGetResourceHandle(). But the project works fine in VS2003. Can anybody tell me what causes this issue and how to fix it? Thanks!

    L A 2 Replies Last reply
    0
    • A Andraw Tang

      Hi, dear all, I have a C++ project created in VS2003, now I convert it to VS2008, after fix some compile errors and setting change, it compiles ok and can be started. This project application is an EXE file, not DLL file. When I create a dialog object and call dlg.doModal(), get afxwin1.inl ASSERT error in AfxGetResourceHandle(). But the project works fine in VS2003. Can anybody tell me what causes this issue and how to fix it? Thanks!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Without seeing the actual code and the specific details of the ASSERT it is not very likely that we can guess what is going wrong.

      Unrequited desire is character building. OriginalGriff

      A 1 Reply Last reply
      0
      • L Lost User

        Without seeing the actual code and the specific details of the ASSERT it is not very likely that we can guess what is going wrong.

        Unrequited desire is character building. OriginalGriff

        A Offline
        A Offline
        Andraw Tang
        wrote on last edited by
        #3

        CEditDlg *m_editDlg = new CEditDlg(this,propComp,propComp->Getbitmap(), propComp->GetType(),pWnd);
        m_editDlg->SetEditComp(propComp);
        m_editDlg->DoModal();

        Error happens when call DoModal(). I debug inside the codes and see the error occurs becuase afxCurrentResourceHandle is NULL. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() { ASSERT(afxCurrentResourceHandle != NULL); return afxCurrentResourceHandle; } It seems the resouce doesn't attache to the project, right, how can I solve it?

        L 1 Reply Last reply
        0
        • A Andraw Tang

          CEditDlg *m_editDlg = new CEditDlg(this,propComp,propComp->Getbitmap(), propComp->GetType(),pWnd);
          m_editDlg->SetEditComp(propComp);
          m_editDlg->DoModal();

          Error happens when call DoModal(). I debug inside the codes and see the error occurs becuase afxCurrentResourceHandle is NULL. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() { ASSERT(afxCurrentResourceHandle != NULL); return afxCurrentResourceHandle; } It seems the resouce doesn't attache to the project, right, how can I solve it?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Since this is your own dialog you need to review the constructor to ensure you are correctly instantiating from a base CDialog()[^] class.

          Unrequited desire is character building. OriginalGriff

          A 1 Reply Last reply
          0
          • L Lost User

            Since this is your own dialog you need to review the constructor to ensure you are correctly instantiating from a base CDialog()[^] class.

            Unrequited desire is character building. OriginalGriff

            A Offline
            A Offline
            Andraw Tang
            wrote on last edited by
            #5

            I told you everything works fine in VS2003. Also in VS2008 Release mode. Yes,my dialog inherits from Dialog class, and in instructor, I do something like the following:

            CEditDlg::CEditDlg( System::Object * mainApp, NCGenericCompont* pCompont, UINT menuSel, CString type,CWnd* pParent /*=NULL*/)
            : CDialog(CEditDlg::IDD, pParent)

            The codes should have no problem, the problem should be it cannot locates the resource file, there are a lots of people ask this questions about this in internet, but seems cannot find answer.

            L 1 Reply Last reply
            0
            • A Andraw Tang

              I told you everything works fine in VS2003. Also in VS2008 Release mode. Yes,my dialog inherits from Dialog class, and in instructor, I do something like the following:

              CEditDlg::CEditDlg( System::Object * mainApp, NCGenericCompont* pCompont, UINT menuSel, CString type,CWnd* pParent /*=NULL*/)
              : CDialog(CEditDlg::IDD, pParent)

              The codes should have no problem, the problem should be it cannot locates the resource file, there are a lots of people ask this questions about this in internet, but seems cannot find answer.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Well it's always possible this is a bug that should be reported to Microsoft.

              Unrequited desire is character building. OriginalGriff

              1 Reply Last reply
              0
              • A Andraw Tang

                Hi, dear all, I have a C++ project created in VS2003, now I convert it to VS2008, after fix some compile errors and setting change, it compiles ok and can be started. This project application is an EXE file, not DLL file. When I create a dialog object and call dlg.doModal(), get afxwin1.inl ASSERT error in AfxGetResourceHandle(). But the project works fine in VS2003. Can anybody tell me what causes this issue and how to fix it? Thanks!

                A Offline
                A Offline
                Arun Parthasarathy
                wrote on last edited by
                #7

                Hi, Please check whether ur object is created properly before u call the domodal(). If it is fine, keep the break point in the dialog class's "oninitdialog" function and move forward step by step. I guess the issue would be in any of the controls u have used. Thanks, Arun P.

                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