Click here to Skip to main content
14,878,631 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win32 Structures Pin
Mircea Neacsu14-Mar-21 10:36
mvaMircea Neacsu14-Mar-21 10:36 
AnswerRe: Win32 Structures Pin
11917640 Member 17-Mar-21 3:01
Member11917640 Member 17-Mar-21 3:01 
GeneralRe: Win32 Structures Pin
Richard Andrew x6417-Mar-21 9:20
professionalRichard Andrew x6417-Mar-21 9:20 
GeneralRe: Win32 Structures Pin
11917640 Member 17-Mar-21 19:19
Member11917640 Member 17-Mar-21 19:19 
QuestionZoom image on mouse position Pin
Gopi Nath12-Mar-21 0:20
MemberGopi Nath12-Mar-21 0:20 
AnswerRe: Zoom image on mouse position Pin
Richard MacCutchan12-Mar-21 1:28
mveRichard MacCutchan12-Mar-21 1:28 
GeneralRe: Zoom image on mouse position Pin
Gopi Nath14-Mar-21 20:34
MemberGopi Nath14-Mar-21 20:34 
QuestionSelect TRACE functions based on both a variable and a #define? Pin
arnold_w11-Mar-21 5:31
Memberarnold_w11-Mar-21 5:31 
I'm working on an embedded ARM-project (STM32F) and I'm programming in C programming language and compiling with Eclipse/GCC. In the project there is TRACE functionality implemented that, if enabled, logs various things over UART using queues and DMA:
#define TRACE(grp, lvl, ...) traceToPrintStream(grp, __FILE__, __FUNCTION__, __LINE__, lvl, __VA_ARGS__)
It can be used, e.g. like this:
TRACE("regCallbacks", T_D, "The user pressed the button");
TRACE("regCallbacks", T_D, "Write to reg %d. First written byte: 0x%X", regAddr, regValues[0]);
I need a different trace that is not queued, does not use DMA and does not include the file name, function name and line number, but the other persons in this project do not agree to throw out the existing TRACE, so I need to make something in parallel. I want to be able to enable my TRACE in two ways, either by #defines:
#define ENABLE_USER_EVENTS_LOGGING
#define ENABLE_COMMUNICATOIN_BUS_LOGGING
or by setting a varible during runtime:
Bool_t enableCommunicationBusLogging;
Bool_t enableUserEventsLogging;
I need a different grouping (the grp parameter) than the others, so the example TRACEings above would have to be augmented with my grouping as well:
TRACE_EX("regCallbacks", USER_EVENTS, T_D, "The user pressed the button");
TRACE_EX("regCallbacks", COMMUNICATION_BUS, T_D, "Write to reg %d. First written byte: 0x%X", regAddr, regValues[0]);
The rules I would like to apply are:
1. If my TRACE is enabled using the macros (hardcode enabled), then the other TRACE can not be used (hardcode disabled).
2. If my TRACE is not enabled using the macros, then both TRACEs can be enabled/disabled during runtime independently of each other. However, they are enabled per groups!

Does anybody know how I can solve this? I found a great website (C Preprocessor tricks, tips, and idioms · pfultz2/Cloak Wiki · GitHub[^]) that shows some really neat macro-tricks, but I'm not sure how to apply it my case.
AnswerRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan11-Mar-21 6:11
mveRichard MacCutchan11-Mar-21 6:11 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w11-Mar-21 7:07
Memberarnold_w11-Mar-21 7:07 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan11-Mar-21 23:11
mveRichard MacCutchan11-Mar-21 23:11 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w12-Mar-21 0:54
Memberarnold_w12-Mar-21 0:54 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan12-Mar-21 1:22
mveRichard MacCutchan12-Mar-21 1:22 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
arnold_w12-Mar-21 1:51
Memberarnold_w12-Mar-21 1:51 
GeneralRe: Select TRACE functions based on both a variable and a #define? Pin
Richard MacCutchan12-Mar-21 2:43
mveRichard MacCutchan12-Mar-21 2:43 
QuestionMFC: CMFCPropertysheet CMFCPropertypage Pin
Member 1325158810-Mar-21 19:35
MemberMember 1325158810-Mar-21 19:35 
AnswerRe: MFC: CMFCPropertysheet CMFCPropertypage Pin
Victor Nijegorodov10-Mar-21 20:21
MemberVictor Nijegorodov10-Mar-21 20:21 
QuestionMessage Closed Pin
1-Mar-21 8:30
MemberMember 150871421-Mar-21 8:30 
QuestionCMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Member 1488267128-Feb-21 15:52
MemberMember 1488267128-Feb-21 15:52 
AnswerRe: CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Randor 4-Mar-21 10:33
professional Randor 4-Mar-21 10:33 
AnswerRe: CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl Pin
Victor Nijegorodov4-Mar-21 20:39
MemberVictor Nijegorodov4-Mar-21 20:39 
QuestionMFC Dialog Based App Scaling Problem Pin
acerunner31626-Feb-21 6:28
Memberacerunner31626-Feb-21 6:28 
AnswerRe: MFC Dialog Based App Scaling Problem Pin
RedDk26-Feb-21 7:22
MemberRedDk26-Feb-21 7:22 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
acerunner31626-Feb-21 9:03
Memberacerunner31626-Feb-21 9:03 
GeneralRe: MFC Dialog Based App Scaling Problem Pin
Dave Kreskowiak26-Feb-21 9:53
mveDave Kreskowiak26-Feb-21 9:53 

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.