CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Posts
    18

    Anything like TRACE() available in Win32 ?

    Title says it all, folks!

    It would help me a lot if there was some way I could send output to the debug windows with this Win32 API project I'm working on.

    Thanks, RD

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449
    OutputDebugString()

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    _RPTx and _RPTFx from the <crtdbg.h> as well.

    EDIT: corrected the macro spelling of _RTPFx to _RPTF (wierd I still wanted to write RTP?? NC thing?...ohh yea, while we are on NC...obligated to say...Duke Sucks)
    Last edited by Mick; March 15th, 2004 at 01:01 AM.

  4. #4
    Join Date
    May 1999
    Posts
    18

    Thumbs up

    Thank you very much for the replies!

  5. #5
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    If you use the debugger to single-step a TRACE, you will see that it uses AfxTrace.

    AfxTrace calls afxDump.

    afxDump is actually CDumpContext::operator<<(LPCTSTR lpsz).

    CDumpContext::operator<<(LPCTSTR lpsz) calls CDumpContext::OutputString.

    OutputString calls AfxOutputDebugString.

    Guess what AfxOutputDebugString calls to write the string?
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  6. #6
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Almost all of the debugging report macros can be traced back to finally sending a formatted output string via OutputDebugString(...) I say almost because there are different reporting functinos for kernel mode drivers. The problem is formatting the string first, which is why you have the macros.

    Typicall, I use my own logging facility, so I can control what gets logged via a log level enumeration (and use the and use va_arg to format my strings) in conjunction with EventLogging since most consumers want eventlogging capability, I also usually double back that with my own logfiles, because I don't want critical message or crashes (with stack traces) to disappear when someone gets the itch to clear the eventlog. I am then also able to control what the precompiler removes as far as logging, alot of debug type log messages I do not want evaluated at runtime, so I define the calls away so the preprocessor removes them.

    Probably more than the OP was looking for but meh

  7. #7
    Join Date
    Dec 2002
    Location
    La Plata, Buenos Aires
    Posts
    615
    yeah, build up your own logging code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured