Click here to Skip to main content
15,846,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win32 Structures Pin
Richard Andrew x6417-Mar-21 10:20
professionalRichard Andrew x6417-Mar-21 10:20 
GeneralRe: Win32 Structures Pin
11917640 Member 17-Mar-21 20:19
11917640 Member 17-Mar-21 20:19 
QuestionZoom image on mouse position Pin
Gopi Nath12-Mar-21 1:20
Gopi Nath12-Mar-21 1:20 
AnswerRe: Zoom image on mouse position Pin
Richard MacCutchan12-Mar-21 2:28
mveRichard MacCutchan12-Mar-21 2:28 
GeneralRe: Zoom image on mouse position Pin
Gopi Nath14-Mar-21 21:34
Gopi Nath14-Mar-21 21:34 
QuestionSelect TRACE functions based on both a variable and a #define? Pin
arnold_w11-Mar-21 6:31
arnold_w11-Mar-21 6:31 
AnswerRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan11-Mar-21 7:11
mveRichard MacCutchan11-Mar-21 7:11 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w11-Mar-21 8:07
arnold_w11-Mar-21 8:07 
Ok, so this is what I have now:
C++
#define USER_EVENTS_LOGGING          0x00000001
#define COMMUNICATOIN_BUS_LOGGING    0x00000002
uint32_t enabledMyGrpBitFlags = 0;

#if defined(ENABLE_USER_EVENTS_LOGGING)
#define TRACE_EX(grp, myGrp, lvl, ...)   if (myGrp & USER_EVENTS_LOGGING)       printf_(__VA_ARGS__)
#elif defined(ENABLE_COMMUNICATOIN_BUS_LOGGING)
#define TRACE_EX(grp, myGrp, lvl, ...)   if (myGrp & COMMUNICATOIN_BUS_LOGGING) printf_(__VA_ARGS__)
#else
#define TRACE_EX(grp, myGrp, lvl, ...)                                                 \
	do {                                                                               \
		if (myGrp & enabledMyGrpBitFlags) {                                            \
			printf_(__VA_ARGS__);                                                      \
		}                                                                              \
		traceToPrintStream(grp, __FILE__, __FUNCTION__, __LINE__, lvl, __VA_ARGS__);   \
    } while (0)
#endif
Is it possible to remove the run-time checks:
C++
if (myGrp & USER_EVENTS_LOGGING) 
if (myGrp & COMMUNICATOIN_BUS_LOGGING)
so that the TRACE_EX macro would become empty when the myGrop isn't matching? In other words, let's say only ENABLE_USER_EVENTS_LOGGING (not ENABLE_COMMUNICATOIN_BUS_LOGGING) is defined, then I would like the following line to "disappear" after the preprocessor is finished:
C++
TRACE_EX("regCallbacks", COMMUNICATION_BUS, T_D, "Write to reg %d. First written byte: 0x%X", regAddr, regValues[0]);
Is that possible somehow?
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan12-Mar-21 0:11
mveRichard MacCutchan12-Mar-21 0:11 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w12-Mar-21 1:54
arnold_w12-Mar-21 1:54 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan12-Mar-21 2:22
mveRichard MacCutchan12-Mar-21 2:22 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w12-Mar-21 2:51
arnold_w12-Mar-21 2:51 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan12-Mar-21 3:43
mveRichard MacCutchan12-Mar-21 3:43 
QuestionMFC: CMFCPropertysheet CMFCPropertypage Pin
Member 1325158810-Mar-21 20:35
Member 1325158810-Mar-21 20:35 
AnswerRe: MFC: CMFCPropertysheet CMFCPropertypage Pin
Victor Nijegorodov10-Mar-21 21:21
Victor Nijegorodov10-Mar-21 21:21 
QuestionCMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Member 1488267128-Feb-21 16:52
Member 1488267128-Feb-21 16:52 
AnswerRe: CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Randor 4-Mar-21 11:33
professional Randor 4-Mar-21 11:33 
AnswerRe: CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Victor Nijegorodov4-Mar-21 21:39
Victor Nijegorodov4-Mar-21 21:39 
QuestionMFC Dialog Based App Scaling Problem Pin
acerunner31626-Feb-21 7:28
acerunner31626-Feb-21 7:28 
AnswerRe: MFC Dialog Based App Scaling Problem Pin
RedDk26-Feb-21 8:22
RedDk26-Feb-21 8:22 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
acerunner31626-Feb-21 10:03
acerunner31626-Feb-21 10:03 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
Dave Kreskowiak26-Feb-21 10:53
mveDave Kreskowiak26-Feb-21 10:53 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
acerunner3161-Mar-21 15:00
acerunner3161-Mar-21 15:00 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
Dave Kreskowiak1-Mar-21 15:43
mveDave Kreskowiak1-Mar-21 15:43 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
RedDk26-Feb-21 11:10
RedDk26-Feb-21 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.