-
March 3rd, 2005, 04:20 AM
#1
Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Hi,
i have a dialog based MFC app.
During my coding i get now following error during the Init Process of the first dialog!
So this means before i can see a dialog my app crashes:
Unhandled exception at 0x7c22c81a (mfc71d.dll) in menutree.exe: 0xC0000005: Access violation reading location 0x04a9092d.
Here the Call Stack:
mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fdac, HWND__ * hWnd=0x00130810, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 241 + 0x14 C++
mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x00130810, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 389 C++
> mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x00130810, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 209 + 0x15 C++
user32.dll!77d486cb()
user32.dll!77d4879f()
user32.dll!77d492ab()
user32.dll!77d492f5()
ntdll.dll!77f75da3()
user32.dll!77d4ab37()
user32.dll!77d4ab23()
user32.dll!77d565cb()
user32.dll!77d5657b()
user32.dll!77d5659f()
mfc71d.dll!CWnd::CreateDlgIndirect(const DLGTEMPLATE * lpDialogTemplate=0x004a6ed0, CWnd * pParentWnd=0x00000000, HINSTANCE__ * hInst=0x00400000) Line 310 + 0x2a C++
mfc71d.dll!CDialog:oModal() Line 519 + 0x20 C++
menutree.exe!CMenutreeApp::InitInstance() Line 63 + 0xb C++
mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00141f4a, int nCmdShow=1) Line 39 + 0xb C++
menutree.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00141f4a, int nCmdShow=1) Line 25 C++
menutree.exe!WinMainCRTStartup() Line 390 + 0x39 C
kernel32.dll!77e8141a()
The error occure on following part:
wincore.cpp
Code:
/////////////////////////////////////////////////////////////////////////////
// Official way to send message to a CWnd
LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
WPARAM wParam = 0, LPARAM lParam = 0)
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
MSG oldState = pThreadState->m_lastSentMsg; // save for nesting
pThreadState->m_lastSentMsg.hwnd = hWnd;
pThreadState->m_lastSentMsg.message = nMsg;
pThreadState->m_lastSentMsg.wParam = wParam;
pThreadState->m_lastSentMsg.lParam = lParam;
#ifdef _DEBUG
_AfxTraceMsg(_T("WndProc"), &pThreadState->m_lastSentMsg);
#endif
// Catch exceptions thrown outside the scope of a callback
// in debug builds and warn the user.
LRESULT lResult;
TRY
{
#ifndef _AFX_NO_OCC_SUPPORT
// special case for WM_DESTROY
if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
pWnd->m_pCtrlCont->OnUIActivate(NULL);
#endif
// special case for WM_INITDIALOG
CRect rectOld;
DWORD dwStyle = 0;
if (nMsg == WM_INITDIALOG)
_AfxPreInitDialog(pWnd, &rectOld, &dwStyle);
// delegate to object's WindowProc
lResult = pWnd->WindowProc(nMsg, wParam, lParam); :confused:
// more special case for WM_INITDIALOG
if (nMsg == WM_INITDIALOG)
_AfxPostInitDialog(pWnd, rectOld, dwStyle);
}
CATCH_ALL(e)
{
lResult = AfxProcessWndProcException(e, &pThreadState->m_lastSentMsg);
TRACE(traceAppMsg, 0, "Warning: Uncaught exception in WindowProc (returning %ld).\n",
lResult);
DELETE_EXCEPTION(e);
}
END_CATCH_ALL
pThreadState->m_lastSentMsg = oldState;
return lResult;
}
what can be the problem??
Do you need more infos to help me!
Thanks!
Gernot
-
March 3rd, 2005, 11:14 AM
#2
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Look in your function " menutree.exe!CMenutreeApp::InitInstance() Line 63 + 0xb C++" This is where the problem is.
What does your InitInstance look like?
Viggy
-
March 4th, 2005, 01:53 AM
#3
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Hi,
here is my initInstance:
Line 63 is marked bold!!
Code:
BOOL CMenutreeApp::InitInstance()
{
// InitCommonControls() 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.
InitCommonControls();
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"));
CMenutreeDlg dlg;
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;
}
But whats the problem!
This is generated automatically from the .Net environment!?!?!?!?
Thanks
-
March 4th, 2005, 08:05 AM
#4
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
HI!
I found the error!!!!
I load during the OnInitDialog the different Icons, which i use.
hIcon[0] = AfxGetApp()->LoadIcon(IDI_COMP);
hIcon[1] = AfxGetApp()->LoadIcon(IDI_COMP1);
....
and this runs until 24 items.
And i set the HICON hIcon in the header file only to 23. So it crashes, because i try to access a not existing hicon element.
Thanks for you investigation
bye
Gernot
-
March 4th, 2005, 11:56 AM
#5
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
-
March 31st, 2016, 10:27 PM
#6
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Hello.. i have same problem like this. Please help me.
-
April 1st, 2016, 03:23 AM
#7
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Originally Posted by maas
Hello.. i have same problem like this. Please help me.
Well, then fix it the same way like this.
Victor Nijegorodov
-
April 1st, 2016, 03:24 AM
#8
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
[thread was moved from Managed C++/CLI forum...]
Victor Nijegorodov
-
April 1st, 2016, 06:30 PM
#9
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Originally Posted by VictorN
[thread was moved from Managed C++/CLI forum...]
Eventually... It's been in C++/CLI since 11 years... ☺
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
April 2nd, 2016, 02:41 AM
#10
Re: Unhandled exception at 0x7c22c81a (mfc71d.dll) during InitDialog
Originally Posted by Eri523
Eventually... It's been in C++/CLI since 11 years... ☺
Yes. Unfortunately... Although there is nothing concerning managed code. Only the native 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
|