Ever felt the need for a simple thing like, you print something to developer studio output window and when you double click on that line it takes us to the place from where this was output.
For eg: You have an unknown exception and you put a trace statement which prints the file name and line number to developer studio output window, so when you double click on that line in developer studio it takes us to the place where this exception was traced out. Much like the error statements in output window of developer studio. You press F4/F8 and our cursor is on the line which caused the error.
Here is a macro that does this…
[sourcecode language=’cpp’]#if ! defined UNKNOWN_EXCEPTION
# ifdef _DEBUG
# define UNKNOWN_EXCEPTION AfxTrace(_T(“n%s(%i): Unknown Exception occurred!!”), _T(__FILE__),__LINE__)
# define UNKNOWN_EXCEPTION 0
Now just use this from somewhere you want to do a trace for eg:
[sourcecode language=’cpp’]void SomeFunkyStuff()
char *Blah = 0;
*Blah = 0; // Hope this throws an exception
catch( … )
}// End try
}// End SomeFunkyStuff[/sourcecode]
So now when exception is thrown, a trace statment will be printed to developer studio output window, double click on the line your cursor should be on the line which traced out this line to developer studio output window. Well if it doesn’t then 😛
This is not my idea, shamelessly stolen from MSDN, which was originally given by someone.