in dialog dll because of App class instance application being crashed
-
I have dll where I am creating a dialog whihc is shown from the mfc client application. I loading this dll as an extension dll, then by implementing Do.Modal() function I am showing the dialog which has menus, toolbars,black model visualization screen. When trying to display this screen, it's crashing as debug ASSERT failed, at appcore.cpp ASSERT(AfeGetThread()==NULL) My App class is like this in the header file I have the App constructor and in .cpp file I have the construcor and also one instance of ViewApp as below //MyViewApp.h [code] //Inside the class definition MyViewApp(); //constructor dclaration //outside the class definition extern MyViewApp theApp; [/code] //MyViewApp.cpp [code] MyViewApp::MyViewApp() { } MyViewApp theApp; [/code] It's crashing with this code (ASSERT failure in appcore.cpp), and when I am removing this constructor declaration and definition and also removing the one instantiation, then it's not crashing but coming out of the application, My Dialog GUI is not launching. Please help me whats going wrong in this. Thanks a lot for help in advance.
-
I have dll where I am creating a dialog whihc is shown from the mfc client application. I loading this dll as an extension dll, then by implementing Do.Modal() function I am showing the dialog which has menus, toolbars,black model visualization screen. When trying to display this screen, it's crashing as debug ASSERT failed, at appcore.cpp ASSERT(AfeGetThread()==NULL) My App class is like this in the header file I have the App constructor and in .cpp file I have the construcor and also one instance of ViewApp as below //MyViewApp.h [code] //Inside the class definition MyViewApp(); //constructor dclaration //outside the class definition extern MyViewApp theApp; [/code] //MyViewApp.cpp [code] MyViewApp::MyViewApp() { } MyViewApp theApp; [/code] It's crashing with this code (ASSERT failure in appcore.cpp), and when I am removing this constructor declaration and definition and also removing the one instantiation, then it's not crashing but coming out of the application, My Dialog GUI is not launching. Please help me whats going wrong in this. Thanks a lot for help in advance.
My guess would be that you already have a CWinApp derivate instantiated while CWinApp (and so your MyViewApp since it is also a derivate of CWinApp) expects to be the one and only. Sad that in wincore.cpp there seems to be no comment whatsoever around those ASSERT-s to give you some additional information about what's wrong. I suspect that you have MyViewApp inside the DLL and you are loading it into your application which already has a CWinApp derivate. If so, you should try displaying and handling your dialog in the "context of the original application". Could this be it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
-
My guess would be that you already have a CWinApp derivate instantiated while CWinApp (and so your MyViewApp since it is also a derivate of CWinApp) expects to be the one and only. Sad that in wincore.cpp there seems to be no comment whatsoever around those ASSERT-s to give you some additional information about what's wrong. I suspect that you have MyViewApp inside the DLL and you are loading it into your application which already has a CWinApp derivate. If so, you should try displaying and handling your dialog in the "context of the original application". Could this be it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
how can I do that please give me some hint.. I have one api exposed for mfc client called 'runAppli' [code] __declspec(dllexport)runAppli(CString fileName) { CDlgsViewDlg dlg(fileName, NULL); dlg.DoModal(); return true; } [/code] Using this I am calling the dll after loading. So how can I displaying and handling your dialog in the "context of the original application". Please give me some hints.
-
how can I do that please give me some hint.. I have one api exposed for mfc client called 'runAppli' [code] __declspec(dllexport)runAppli(CString fileName) { CDlgsViewDlg dlg(fileName, NULL); dlg.DoModal(); return true; } [/code] Using this I am calling the dll after loading. So how can I displaying and handling your dialog in the "context of the original application". Please give me some hints.
Hard to say without seeing the whole picture, but... Am i right that you have an application class instantiated in both the DLL and the app that loads it? If yes, do you need an application class inside the DLL? If yes, why? If no, try to get rid of it and see if it helps.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
-
I have dll where I am creating a dialog whihc is shown from the mfc client application. I loading this dll as an extension dll, then by implementing Do.Modal() function I am showing the dialog which has menus, toolbars,black model visualization screen. When trying to display this screen, it's crashing as debug ASSERT failed, at appcore.cpp ASSERT(AfeGetThread()==NULL) My App class is like this in the header file I have the App constructor and in .cpp file I have the construcor and also one instance of ViewApp as below //MyViewApp.h [code] //Inside the class definition MyViewApp(); //constructor dclaration //outside the class definition extern MyViewApp theApp; [/code] //MyViewApp.cpp [code] MyViewApp::MyViewApp() { } MyViewApp theApp; [/code] It's crashing with this code (ASSERT failure in appcore.cpp), and when I am removing this constructor declaration and definition and also removing the one instantiation, then it's not crashing but coming out of the application, My Dialog GUI is not launching. Please help me whats going wrong in this. Thanks a lot for help in advance.
sujandasmahapatra wrote:
It's crashing with this code (ASSERT failure in appcore.cpp)
appcore.cpp is a big place! Whenever you ask for help and say an ASSERT is failing for the love of god paste in the code around the ASSERT statement.
Steve