Re: 0xC000 0005 exception in CFrameWnd::OnCmdMsg()

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




The document template was okay.

The problem was a stupid typo on my part; I had reduced an array size but a factor of 100 and was initialising it off the end using the wrong but similarly named constant. What a twit.

Thanks for your help and sorry for wasting your time.

GS.



In message <#eCyADjuGHA.1284@xxxxxxxxxxxxxxxxxxxx>, Tom Serface <tserface@xxxxxxx> writes
Is your document template getting created successfully. I notice you don't
check the pointer before adding it with something like:

if (!pDocTemplate)
return FALSE;

Tom

"Gordon Smith" <gordon@xxxxxxxxxxxxxxxxxxx> wrote in message
news:0SJ4SeCNTE1EFwlP@xxxxxxxxxxxxxxxxxxxxx

But how to find the NULL pointer call?

This is my InitInstance(), it hasn't changed for some time. I've
removed comments for the sake of brevity here.

BOOL CAvtApp::InitInstance()
{
if (::AfxSocketInit())
{
m_bSocketsEnabled = TRUE;
}
else
{
m_bSocketsEnabled = FALSE;
}

if (!::AfxOleInit())
{
if (IDNO == ::AfxMessageBox(IDP_OLE_INIT_FAILED,
MB_YESNO | MB_ICONQUESTION))
{
_ReclaimAppResources();

return(FALSE);
}
}

::AfxEnableControlContainer();

(void)Enable3dControlsStatic();

SetRegistryKey(_T("Octec Ltd"));

LoadStdProfileSettings(10);

_CheckWindowsVersion();

if (!_CheckCommandLine(__argc, __argv))
{
return(FALSE);
}

if (!_InitSystem())
{
_ReclaimAppResources();

return(FALSE);
}

CSingleDocTemplate* pDocTemplate;

pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CAvtDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CAdept36View));

AddDocTemplate(pDocTemplate);

CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

if (!ProcessShellCommand(cmdInfo))
{
_ReclaimAppResources();

return(FALSE);
}

_PrepareAlternativeViews();

m_bJustPoweredUp = FALSE; // Initialisation complete

m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

_SetMainWindowLegend(((CFrameWnd*)m_pMainWnd)->GetActiveView());

return(TRUE);
}

Because of the CN_COMMAND_UPDATE_UI connection I tried removing all of
my status bar indicators and I get farther before I crash. I can now
getting through InitInstance() and it crashes calling pThread->Run() in
AfxWinMain().

Thanks for your help.
GS.



In article <OdSmn39tGHA.1272@xxxxxxxxxxxxxxxxxxxx>, Tom Serface
<tserface@xxxxxxx> writes
Could you be calling ProcessShellCommand() before the mainframe is
created.
This looks a lot like a NULL pointer call to a function. From your
subject
line it looks like the OnCmdMsg() is in the frame window.

Tom

"Fenster" <fenster@xxxxxxxxxxxxx> wrote in message
news:GpnBQVF$w00EFwJC@xxxxxxxxxxxxxxxxxxxxxxxxxx

I'm really stumped on this one. I don't know where to go at all. I'm
not
even that sure what information may be required by those willing to have
a
read.

The call stack shows that I'm getting the exception somewhere in the
ProcessShellCommand() call in my application's InitInstance().

The exception occurs just after AfxGetApp() is called in OnCmdMsg(). The
CWinApp* appears to be valid (i.e. it's not NULL) so I assume that the
pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo) call is where it's all
going wrong.

nID is a valid indicator ID for a pane on my status bar. nCode is -1
which is CN_UPDATE_COMMAND_UI and therefore seems consistent with nID
being for the status bar. pExtra is not NULL but I'm not sure what it's
pointing at (or should be pointing at for that matter). pHandlerInfo is
NULL (not sure if this okay or not).

This is an application that has been running, in one form or another,
for
a number of years. The changes made since the last running version are
related to changing large static data arrays to "new"ing them at run
time
(on power-up) but I can't see any connection between this and what looks
to me like a messaging problem.

Any help would appreciated. Thanks.

--
Fenster



--
Gordon Smith

If you feel it's necesary to e-mail me directly my address should be:

gordon at gordys dot demon dot co dot uk



--
Fenster
.



Relevant Pages

  • Re: Dictionaries and dot notation
    ... mydata.bar = 'bar' ... Okay let me rephrase my question: is there a way of using dot ...
    (comp.lang.python)
  • Re: C# very optimisation
    ... Hey Jon! ... >> Okay, well you got me on this one, I can't show it right now. ... I'm actually using an array. ... manager said that my memory usage peaked out at one point at 1.5 gigs -- ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Gloves and Bench Pressing
    ... Okay, ixnay on the illingkay. ... Probably just what the movie industry needs! ... pack at a bar. ... leave it on the bar or the table. ...
    (misc.fitness.weights)
  • Re: Show chapter headings in footers
    ... Make sure the status bar is showing (if not, turn it on in Preferences, ... while as your template repaginates from 700 pages to 180. ... Okay, ... Onto the original problem, the missing footers. ...
    (microsoft.public.mac.office.word)
  • Re: Belated look at the OSXhints April Fools front page
    ... The menu bar is nothing remotely like the Dock, ... Application Menu, and Hierarchical Apple Menu. ... Okay, OS X gave us the problem that the Control Strip was taken away ...
    (uk.comp.sys.mac)