devxlogo

Navigate the TRACEs in Your Code

Navigate the TRACEs in Your Code

If you put many TRACE’s, in your code, it might be very convenient to jump to each one of them by double clicking a text line in the Debug window.

//With IMMsgBox function one can Drop an "interactive" message on aScreen,//or a message in Debug window#include "stdafx.h"#include #include #define DROP_SCREEN				 0#define DROP_DEBUG_MSG			-1#define DROP_DBG_MSG_TRACEBLE	-2#define TRACE_HERE				__FILE__, -__LINE__int IMMsgBox(char * Caption, int Type, char * FormatString, ...){	char Text[1024], TracedText[1500];	va_list pArgList;	va_start(pArgList, FormatString);	vsprintf(Text, FormatString, pArgList);	va_end(pArgList);	if(Type = DROP_SCREEN)		return MessageBox(NULL, Text, Caption, Type);	if(Type == DROP_DEBUG_MSG)	{		OutputDebugString(Text);		return Type;	}	return -1;}int main(){	if(IMMsgBox("Caption", DROP_SCREEN + (MB_YESNOCANCEL | MB_ICONQUESTION),		"Text containing int %d double %f and string %s", 123, -1.234, "ABCDefg") == IDYES)		MessageBox(NULL, "You've clicked Yes", "Hi, User", MB_OK);	IMMsgBox(NULL, DROP_DEBUG_MSG, "Text containing int %d double %f and string %s",		123, -1.234, "ABCDefg");	IMMsgBox(TRACE_HERE, "Text containing int %d double %f and string %s",123, -1.234, "ABCDefg");	return 0;}
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist