3 #ifdef _PSEUDO_DEBUG // entire file
7 static char THIS_FILE
[] = __FILE__
;
11 LONG AssertReallyBusy
= -1;
13 BOOL
AssertFailedLine(LPCSTR lpszFileName
, int nLine
)
15 TCHAR szMessage
[_MAX_PATH
*2];
17 InterlockedDecrement(&AssertReallyBusy
);
19 // format message into buffer
20 wsprintf(szMessage
, _T("File %hs, Line %d"),
23 TCHAR szT
[_MAX_PATH
*2 + 20];
24 wsprintf(szT
, _T("Assertion Failed: %s\n"), szMessage
);
25 OutputDebugString(szT
);
27 if (InterlockedIncrement(&AssertBusy
) > 0)
29 InterlockedDecrement(&AssertBusy
);
31 // assert within assert (examine call stack to determine first one)
36 // active popup window for the current thread
37 HWND hWndParent
= GetActiveWindow();
38 if (hWndParent
!= NULL
)
39 hWndParent
= GetLastActivePopup(hWndParent
);
42 int nCode
= ::MessageBox(hWndParent
, szMessage
, _T("Assertion Failed!"),
43 MB_TASKMODAL
|MB_ICONHAND
|MB_ABORTRETRYIGNORE
|MB_SETFOREGROUND
);
46 InterlockedDecrement(&AssertBusy
);
48 if (nCode
== IDIGNORE
)
49 return FALSE
; // ignore
52 return TRUE
; // will cause DebugBreak
54 AfxAbort(); // should not return (but otherwise DebugBreak)
58 void Trace(LPCTSTR lpszFormat
, ...)
61 va_start(args
, lpszFormat
);
66 nBuf
= _vstprintf(szBuffer
, lpszFormat
, args
);
67 ASSERT(nBuf
< (sizeof(szBuffer
)/sizeof(szBuffer
[0])));
71 if (AfxGetApp() != NULL
)
72 strMessage
= ((CString
) (AfxGetApp()->m_pszExeName
)) + _T(": ");
73 strMessage
+= szBuffer
;
74 OutputDebugString(strMessage
);
80 #endif // _PSEUDO_DEBUG