Exception Error.

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2009
Posts: 3
Reputation: fish786 is an unknown quantity at this point 
Solved Threads: 0
fish786 fish786 is offline Offline
Newbie Poster

Exception Error.

 
0
  #1
Jul 24th, 2009
I am new at programming and would like someone to assist me as to what I am looking for?

As far as I know I have followed the instructions I found on one of the sites. Can someone please help?
I am using VStudio 2008, creating an MFC application.

I am trying to create a new property sheet based application.
All I have is 1 property page and the property sheet itself.
I have just created this project. Basically it's an empty project.
When I run it through the debugger I get the following error:

First-chance exception at 0x5d0c373e in Temp.exe: 0xC0000005: Access violation writing location 0x00435454.

The debugger stops at:
BOOL AFXAPI AfxDeactivateActCtx(DWORD dwFlags, ULONG_PTR ulCookie)
{
BOOL rc = pfnDeactivateActCtx != 0 ? pfnDeactivateActCtx(dwFlags, ulCookie) : FALSE;
return rc;
}

Will someone be nice and help?
Thanks a million.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 3
Reputation: Renaissanz is an unknown quantity at this point 
Solved Threads: 0
Renaissanz Renaissanz is offline Offline
Newbie Poster

Re: Exception Error.

 
0
  #2
Jul 24th, 2009
Well, not having '08, I'm stabbing in the dark here, but the primary suspect is pfnDeactivateActCtx. One of the easiest ways to get the "0xC0000005" violation is to access garbage memory. I recommend stepping through where pfnDeactivateActCtx is initialized. I'd bet that it's not happening correctly or not happening at all, and pfnDeactivateActCtx is a garbage address.

If you're still having trouble, I recommend you post the pfnDeactivateActCtx init code, that will tell us more.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: fish786 is an unknown quantity at this point 
Solved Threads: 0
fish786 fish786 is offline Offline
Newbie Poster

Re: Exception Error.

 
0
  #3
Jul 24th, 2009
Thanks for trying to help me. I have put Traces and I am getting the error after this statement.

BOOL bResult = CPropertySheet::OnInitDialog();

This is the First and only statement I have in the OnInitDialog of my Property Sheet class.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Exception Error.

 
0
  #4
Jul 25th, 2009
> The debugger stops at:
Work your way back up the call stack, and work your way back through each nested function code.
Examine the variables in each nested function, are they all set correctly for the current moment?

Put a breakpoint at the start of the calling function, re-run the code, then single-step and examine data as you go.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: fish786 is an unknown quantity at this point 
Solved Threads: 0
fish786 fish786 is offline Offline
Newbie Poster

Re: Exception Error.

 
0
  #5
Jul 25th, 2009
I just tried this. I have a feeling it's something in the project setting or compiler options. I am not sure what the compiler options should be even though I left them at default.

Here is what I have done to create this project as per the instructions on one of the sites.

Steps:
1) Create a dialog based application.
2). Create Property pages.
3) Using the add class create a derived class from property sheet.
4). Change the following in theAPP
CLastTrySheet dlg(_T("LastTry"));
dlg.m_psh.dwFlags |= PSH_NOAPPLYNOW;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();

Step 6: The constructor of the sheet.

CLastTrySheet::CLastTrySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage(&m_Page01);
}
CLastTrySheet::CLastTrySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage(&m_Page01);
}
Step 7: In the OnInitDialog:
BOOL CLastTrySheet::OnInitDialog()
{
TRACE("Exception error b4.\n");
BOOL bResult = CPropertySheet::OnInitDialog();
TRACE("Exception error After.\n");
}


The above is the only code I have in the OnInitDialog.

I get my error in CPropertySheet::OnInitDialog();

Is there a way in debug to check "Access violation writing location 0x00416e8c". Whats at this location?
If thats what you asked me to do, I am sorry I don't know where to look for it in debug.

Thanks for your help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 452 | Replies: 4
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC