Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i click on OK button of my model dialog box, this code through these exception

First-chance exception at 0x78a4a924 (mfc90ud.dll) in myproject.exe: 0xC0000005: Access violation reading location 0x00000020.

and then i click BREAK the debug, code goes to wincore.cpp UpdateData method ..
Thanks in advanced.

[EDIT by Jochen Arndt: Text posted as solution]

when i changed the TAB in my app, this method will get called.
And i just want to create Model dialog while switching the tab. But i create Modeless dlg its working fine with Create()(without error).. and i just wanna to create model dialog(using DoMdal())

My method is...
C++
void ParentClassName::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
    // Get the number of the currently selected tab, and show it
    ShowWindowNumber(m_cTab.GetCurFocus()); 
    if(m_cTab.GetCurFocus() == 1){      
        CModeless m_pmodeless;
        m_pmodeless.DoModal();    
    }                   
    pNMHDR = NULL;
    pResult = NULL;
}
Posted
Updated 16-Apr-15 3:03am
v3
Comments
Black_Rose 16-Apr-15 7:46am    
Without seeing code it's not possible to help you..
Member 11482033 16-Apr-15 8:24am    
when i changed the TAB in my app, this method will get called.
And i just want to create Model dialog while switching the tab. But i create Modeless dlg its working fine with Create()(without error).. and i just wanna to create model dialog(using DoMdal())

My method is...

void ParentClassName::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the number of the currently selected tab, and show it

ShowWindowNumber(m_cTab.GetCurFocus());
if(m_cTab.GetCurFocus() == 1){
CModeless m_pmodeless;
m_pmodeless.DoModal();
}
pNMHDR = NULL;
pResult = NULL;
}
barneyman 16-Apr-15 7:52am    
i'd GUESS you're trying to access a member 32 bytes into the vtable/offset of a class, when the instance is NULL; look at the stack trace, and work back to your codebase - should stick out like a zit
Leo Chapiro 16-Apr-15 8:00am    
lets look into your source code, dude!
Member 11482033 16-Apr-15 8:24am    
when i changed the TAB in my app, this method will get called.
And i just want to create Model dialog while switching the tab. But i create Modeless dlg its working fine with Create()(without error).. and i just wanna to create model dialog(using DoMdal())

My method is...

void ParentClassName::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the number of the currently selected tab, and show it

ShowWindowNumber(m_cTab.GetCurFocus());
if(m_cTab.GetCurFocus() == 1){
CModeless m_pmodeless;
m_pmodeless.DoModal();
}
pNMHDR = NULL;
pResult = NULL;
}

1 solution

It is a usual MFC-problem: control-ID in the resoure arent matching the IDs in the code. Sometimes helps an "Rebuild all". If not you must fizzle through the ID or set break point in the DoDataExchange routines.

Tip: deactive one tab after the other so you better find the problematic page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900