I've migrated *MFC* project from VC 6 to VS 2010 project. Now a custom dialog we implemented uses the CDialog::DoModal and it isn't working and it fails at this line HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG) As in the new project it returns Null and in the old it gets a value. - The project builds normally so I don't think I forget to import a resource? - I am using ribbons in the new project if this could have relation with the problem? - Should I change the inheritance of the custom dialog to CDialogEx?
Updated I created a new custom dialog that inherits CDialog and DoModal worked very well The problem are with those lines exactly in the DoModal
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
As hInst doesn't return normally so all other callings fail. The issue is related to using dialogs and resources that are in another dll. I still don't understand why did the problem appear in VS2010 and didn't appear in VS 6. And How could This issue be resolved!