How do I debug the above error? I'm using C++ with Microsoft Visual Studio.
Below is part of the code:
HDC dc =*mMemDC;
X->SelectPalette(dc);
When I debug the code, it crashes on the line X->selectPallete(dc);
How do I debug the above error? I'm using C++ with Microsoft Visual Studio.
Below is part of the code:
HDC dc =*mMemDC;
X->SelectPalette(dc);
When I debug the code, it crashes on the line X->selectPallete(dc);
Set a breakpoint at X->SelectPalette(dc);
. Inspect X
. If it doesn't look like a valid pointer(i.e. in this case an address around 0x0b9ec715
) or is 0
, then it's definitely a bad pointer. Also provide more code, as what you've given doesn't really answer any questions.
Use the debugger to check what the values in mMemDC and X are. Some code at memory address 0x0b9ec715 is trying to read memory at the invalid location of 0x00000004. 0xC0000005 is the code that signifies an error when trying to read memory at an invalid location.
Also, you may get a few ideas about other exceptions with weird memory "addresses" here: http://blog.sina.com.cn/s/blog_598c00790100a6a0.html