|
-
April 5th, 2012, 01:18 AM
#1
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;
//MyViewApp.cpp
Code:
MyViewApp::MyViewApp()
{
}
MyViewApp theApp;
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.
-
April 5th, 2012, 01:32 AM
#2
Re: in dialog dll because of App class instance application being crashed
Where is your MyViewApp::InitInstance implementation?
Victor Nijegorodov
-
April 5th, 2012, 01:52 AM
#3
Re: in dialog dll because of App class instance application being crashed
It is there in the MyViewApp.cpp file after the constructor.
Code:
// DlgsView.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "DlgsView.h"
#include "DlgsViewDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CDlgsViewApp
BEGIN_MESSAGE_MAP(CDlgsViewApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CDlgsViewApp construction
CDlgsViewApp::CDlgsViewApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CDlgsViewApp object
CDlgsViewApp theApp;
// CDlgsViewApp initialization
BOOL CDlgsViewApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CDlgsViewDlg dlg(L"", NULL);
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
-
April 5th, 2012, 03:19 AM
#4
Re: in dialog dll because of App class instance application being crashed
 Originally Posted by sujan.dasmahapatra
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
Well, please, don't invent non-existing MFC constructions!
There is no such a AfeGetThread function, there is AfxGetThread
And there is no Do.Modal() "function", you probably meant DoModal()?
 Originally Posted by sujan.dasmahapatra
//MyViewApp.h
Code:
//Inside the class definition
MyViewApp(); //constructor dclaration
//outside the class definition
extern MyViewApp theApp;
What class exactly do you use in your project: MyViewApp or CDlgsViewApp? 
 Originally Posted by sujan.dasmahapatra
It is there in the MyViewApp.cpp file after the constructor.
Code:
// DlgsView.cpp : Defines the class behaviors for the application.
//
...
// CDlgsViewApp
CDlgsViewApp::CDlgsViewApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CDlgsViewApp object
CDlgsViewApp theApp;
...
}
How many global App objects did you defined in your exe? In dll?
Victor Nijegorodov
-
April 5th, 2012, 05:31 AM
#5
Re: in dialog dll because of App class instance application being crashed
-
April 5th, 2012, 05:39 AM
#6
Re: in dialog dll because of App class instance application being crashed
 Originally Posted by sujan.dasmahapatra
CDlgsViewApp
Well, why did you ignore my second question? 
Well, again:
 Originally Posted by VictorN
...
What class exactly do you use in your project: MyViewApp or CDlgsViewApp?
How many global App objects did you defined in your exe? In dll?
And now the third question: is your dll an extension or a regular one?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|