| | |
Unhandled Exception Error
![]() |
•
•
Join Date: Oct 2008
Posts: 11
Reputation:
Solved Threads: 0
I am resurrecting old code from a few years ago, and I unfortunately have little documentation as to how it was compiled and what environment it was built in. At this point, I have successfully gotten it to build, but there are errors at execution, specifically an unhandled exception error on a memory access. The error text is:
It is always the same memory address that is the location, and when I break out of the program it takes me to the following function:
Specifically, it's the call to timeGetDevCaps that is where the error occurs. I don't pretend to know all the intricacies of how pointers work - I am a mechanical engineer who has picked up some programming. However, that's the only thing that I can think of because of the association with an address. Any suggestions?
•
•
•
•
Unhandled exception at 0x0002cb80 in Lab4_2008.exe: 0xC0000005: Access violation reading location 0x0002cb80.
C++ Syntax (Toggle Plain Text)
UINT CHapticThread::GetClosestPossiblePeriod(UINT period) { TIMECAPS timecaps; MMRESULT mmRes; mmRes = ::timeGetDevCaps( &timecaps, sizeof(TIMECAPS) ); assert(mmRes == TIMERR_NOERROR); if ( period < timecaps.wPeriodMin ) return timecaps.wPeriodMin; if ( period > timecaps.wPeriodMax ) return timecaps.wPeriodMax; return period; }
Specifically, it's the call to timeGetDevCaps that is where the error occurs. I don't pretend to know all the intricacies of how pointers work - I am a mechanical engineer who has picked up some programming. However, that's the only thing that I can think of because of the association with an address. Any suggestions?
I think it's just this.
http://msdn.microsoft.com/en-us/library/ms713416.aspx
But the execution address and the read address being the same seems kinda odd to me.
If that really is the case, then the code took a flying jump off a cliff (typically, following an uninitialised function pointer). The "stack" at that point is pretty much meaningless, so I wouldn't put too much store in that.
Putting a breakpoint at the call, then trying "step over" would give more concrete information as to whether this was the cause, or merely the last bit of salvageable stack from the disaster which follows.
http://msdn.microsoft.com/en-us/library/ms713416.aspx
But the execution address and the read address being the same seems kinda odd to me.
If that really is the case, then the code took a flying jump off a cliff (typically, following an uninitialised function pointer). The "stack" at that point is pretty much meaningless, so I wouldn't put too much store in that.
Putting a breakpoint at the call, then trying "step over" would give more concrete information as to whether this was the cause, or merely the last bit of salvageable stack from the disaster which follows.
•
•
Join Date: Oct 2008
Posts: 11
Reputation:
Solved Threads: 0
Sorry, you lost me on the execution address and the read address being the same. The attempted read address is repeated twice, if that's what you are referring to, but that's what happened everywhere else I saw the error.
Salem is correct - the timeGetDevCaps function is a part of the winmm.lib file, which means that I can't see the code and don't know how the constructor initializes everything.
Salem is correct - the timeGetDevCaps function is a part of the winmm.lib file, which means that I can't see the code and don't know how the constructor initializes everything.
The same means this:
Unhandled exception at 0x0002cb80 in Lab4_2008.exe: 0xC0000005: Access violation reading location 0x0002cb80.
But did you do as I suggest, put a breakpoint on
then step over it?
It that works, then the problem is somewhere else.
Unhandled exception at 0x0002cb80 in Lab4_2008.exe: 0xC0000005: Access violation reading location 0x0002cb80.
But did you do as I suggest, put a breakpoint on
mmRes = ::timeGetDevCaps( &timecaps, sizeof(TIMECAPS) ); then step over it?
It that works, then the problem is somewhere else.
![]() |
Similar Threads
- 'Object variable or With block variable not set' Error (ASP.NET)
- "Unhandled Exception" (C++)
- Unhandled Exception Error (VB.NET)
- Help with unhandled exception (C++)
- An unhandled exception of type 'System.Net.Sockets.SocketException' error (ASP.NET)
- refresh datagrid causes error if oper scrolled off right side of grid (VB.NET)
- Big Problem, Generic Error (VB.NET)
- c++ debugging error (C++)
- Error when installing some .exe programs (Windows 95 / 98 / Me)
Other Threads in the C++ Forum
- Previous Thread: How to to calculate the factorial of a given integer WITHOUT using recursion.
- Next Thread: Help with the goto thing.
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph guess gui homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






