分类: C/C++
2012-06-11 16:02:59
原文:
I have a code that is called on a pointer that may be invalid (I have no control over its value):
But when I try to use it in a MFC project, it gives me this error:
error C2712: Cannot use __try in functions that require object unwinding
解决方法:
__try
{
DoStuffWithWParam(wParam);
}
__except(1)
{
//Memory fault
}
void DoStuffWithWParam(WPARAM wParam) {
CString str = (LPCTSTR)wParam;
//Work with 'str' now
}