Project Converted From VS2003 to VS2008, get exception when call dialog.doModal
-
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!
-
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!
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
-
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
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?
-
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?
-
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
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.
-
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.
Well it's always possible this is a bug that should be reported to Microsoft.
Unrequited desire is character building. OriginalGriff
-
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!
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.