Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use CTrace::SetLevel for a MFC project that is using a shared MFC core DLL

I have a MFC project using the shared MFC DLL (MFC140UD.DLL).

I want to set the trace level in my debug version to level 4, to get more information about message pumping.

But using CTrace::SetLevel in my code, just sets the debug level for the CTrace object in my personal modules (my EXE file). CTrace ist declared as __declspec(selectany). In the exported symbols of the MFC140UD.LIB I can see no export for the class CTrace or its members.

So using CTrace::SetLevel has no effect on the MFC core MFC140UD.DLL. I always have to set a breakpoint inside the atltrace.h and need to modify the static m_nLevel value in the debugger.

Is there any trick to access the CTrace::m_nLevel value inside the MFC core DLL from my outer MFC EXE?

Note: Also the old AtlTraceTool stuff isn't no longer working and supported.

like image 492
xMRi Avatar asked Sep 19 '25 06:09

xMRi


1 Answers

It should be impossible to access the CTrace::m_nLevel value inside the MFC core DLL from your outer MFC EXE. Each module has its own instance of the CTrace class, that is, you should get the static member variable CTrace::m_nLevel set to the appropiate value in the context of each module. So I'm afraid you cannot configure the trace level in MFC140UD.DLL from your own module when you using the shared MFC DLL.

You can try to call API AtlTraceModifyModule to Set trace level of MFC140UD.dll.

like image 197
DevPreSupport_MSFT Avatar answered Sep 20 '25 21:09

DevPreSupport_MSFT