AfxTrace without MFC
-
I am looking for a way to use the TRACE macros without adding MFC to my project. Does anyone have macro definitions to do this? But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
-
I am looking for a way to use the TRACE macros without adding MFC to my project. Does anyone have macro definitions to do this? But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
void RDTrace(const char* fmt, ...)
{
#ifdef _DEBUG
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);
_vsnprintf(buffer, 1024, fmt, argptr);
va_end(argptr);OutputDebugString(buffer);
#endif
}------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
-
void RDTrace(const char* fmt, ...)
{
#ifdef _DEBUG
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);
_vsnprintf(buffer, 1024, fmt, argptr);
va_end(argptr);OutputDebugString(buffer);
#endif
}------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
Thanks Chris, I just about got this far, but where is the OutputDebugString function declared? I'm currently using to dump my TRACE output to a file, but I would prefer it to come into the IDE so I can see it while it runs. But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
-
Thanks Chris, I just about got this far, but where is the OutputDebugString function declared? I'm currently using to dump my TRACE output to a file, but I would prefer it to come into the IDE so I can see it while it runs. But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
OutputDebugString is a Win32 API function. #include Windows.h to get it. (it's actually in winbase.h). it's what TRACE ends up calling. ODS will even dump stuff in release mode, hence the #ifdef _DEBUG. you can even use the lovely WinDBG32 app to capture these message outside of the IDE. -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
-
OutputDebugString is a Win32 API function. #include Windows.h to get it. (it's actually in winbase.h). it's what TRACE ends up calling. ODS will even dump stuff in release mode, hence the #ifdef _DEBUG. you can even use the lovely WinDBG32 app to capture these message outside of the IDE. -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
Thanks, I gave it a try and it worked. This is the first time I've actually had a question. It's great the speed with which this community answers questions. But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
-
I am looking for a way to use the TRACE macros without adding MFC to my project. Does anyone have macro definitions to do this? But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
You can just grab the code for AfxTrace() from the MFC\src directory and copy it to your program, too. There's also ATLTRACE if you are using ATL. --Mike-- http://home.inreach.com/mdunn/ "Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent :love: your :bob: with :vegemite: and :beer: