|
|
1.1 ! root 1: Microsoft Foundation Classes Microsoft Corporation ! 2: Technical Notes ! 3: ! 4: #7 : Windows debugging trace options ! 5: ! 6: To help debug windows programs, the TRACE() mechanism is used. ! 7: Textual debugging output will go to the debug console (debug terminal ! 8: or CVW window). Debugging and trace options are enabled when ! 9: you compile your program with the _DEBUG symbol defined. ! 10: ! 11: The options described in this note can be set using a debugger, ! 12: in the initialization code of your application, or by using the ! 13: AFX.INI file. A sample AFX.INI file is provided in the \C700\MFC\SRC ! 14: subdirectory. This .INI file turns on diagnostic messages and uses the ! 15: standard options. The file must be placed in your Windows directory. ! 16: ! 17: ! 18: Global switch: ! 19: ============== ! 20: ! 21: By default TRACE output is ignored. If you set the global integer ! 22: 'afxTraceEnabled' to TRUE (1), then TRACE output (and default afxDump output) ! 23: is routed to the debugger. ! 24: ! 25: In CodeView, the following command can be used to set this value using the ! 26: Command Window: ! 27: ! 28: MEI _afxTraceEnabled 1 ! 29: ! 30: This is the "memory enter integer" command. Note the use of the leading ! 31: underscore. This is required when using the MEI command on externally ! 32: visible C symbols. If you are using an MFC library variant with ! 33: CodeView information (the CL /Zi option combined with the LINK /CODEVIEW ! 34: option), which is the default for the _DEBUG libary and program variants, ! 35: then the following will also work: ! 36: ! 37: ? afxTraceEnabled = 1 ! 38: ! 39: ! 40: The flags: ! 41: ========== ! 42: ! 43: The global integer 'afxTraceFlags' is used to turn on the built-in reporting ! 44: features of the MFC library. ! 45: ! 46: The flags are all stored in the global integer 'afxTraceFlags'. It can be ! 47: set under program control or with the debugger. The global integer ! 48: 'afxTraceFlags' uses each bit to select a trace reporting option. ! 49: ! 50: You can turn any bit on or off as desired. Try playing with them to ! 51: get a flavor of the report information they generate. ! 52: ! 53: // example under program control ! 54: afxTraceFlags = 4 + 8; // windows message dumping ! 55: ! 56: This functionality only exists in the debugging version of the library. ! 57: Using the "memory enter integer" command of CodeView, you can set ! 58: the value of this global variable, for example: ! 59: ! 60: MEI _afxTraceFlags 0x004 ! 61: ! 62: Again, note the use of the leading underscore for the MEI command. Also, ! 63: when CodeView information is available the following command works: ! 64: ! 65: ? afxTraceFlags = 0x004 ! 66: ! 67: ----------------------------------------------------------------------------- ! 68: The options: ! 69: ------------ ! 70: ! 71: 0x01 : Multi-app debugging. ! 72: This will prefix each 'TRACE' output with the name of the ! 73: application. This will affect not only the explicit ! 74: TRACE output of your program, but also the additional ! 75: report options described below: ! 76: ! 77: 0x02 : Windows Message report - in message pump ! 78: Report each message received in the main CWinApp message pump. ! 79: List the window handle, the message name or number, ! 80: and the 'wParam' and 'lParam'. ! 81: The report is made after the GetMessage, but before any ! 82: translate or dispatch. ! 83: ! 84: DDE messages will display additional data which is good for ! 85: some debugging scenarios in OLE). ! 86: ! 87: This will display messages that are posted - not those that ! 88: are sent. ! 89: ! 90: 0x04 : Windows Message report - in WndProc ! 91: Like option '2' but applies to messages dispatched in the ! 92: CWnd::WindowProc (i.e. handles both posted and sent messages). ! 93: that are about to be dispatched). ! 94: ! 95: 0x08 : Command handling report ! 96: A special case for WM_COMMAND/OnCommand handling. Will ! 97: report the progress of the command routing mechanism. ! 98: Reports which class receives the command (i.e. there is ! 99: a matching message map entry). Also reports when classes ! 100: don't receive a command (i.e. there is no matching message ! 101: map entry). ! 102: This is useful for MDI apps to see the flow of command ! 103: messages (i.e. child gets first crack, then frame). ! 104: ! 105: 0x10 : Verbose OLE reporting. ! 106: This will report significant OLE notifications or requests. ! 107: Turn this on for an OLE client or server to get an indication ! 108: of the communication between the OLE DLLs and your OLE app. ! 109: ! 110: ----------------------------------------------------------------------------- ! 111: Ease of Reading: ! 112: ---------------- ! 113: ! 114: For ease of reading, certain frequent messages are not reported. ! 115: These include: ! 116: mouse move messages (non-client and client) ! 117: WM_NCHITTEST ! 118: WM_SETCURSOR ! 119: WM_ENTERIDLE ! 120: WM_CTLCOLOR ! 121: ! 122: I.e. the messages that are sent every time the mouse moves or during ! 123: idle processing or other common dialog processing. ! 124: ! 125: -----------------------------------------------------------------------------
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.