Click here to Skip to main content
13,556,387 members
Click here to Skip to main content
Add your own
alternative version


22 bookmarked
Posted 1 Dec 2002

Runtime Trace

, 30 Mar 2003
Rate this:
Please Sign up or sign in to vote.
Display trace messages at runtime from several running applications on different machines.

Sample Image


Developing complex applications involves a large amount of time spent on bug crushing. Even after you think that everything is ok - and pass to the final release - the soft might throw some surprise errors, invisible while debugging. I present here an application designated to receive TRACE messages from runtime throwers, and two alternatives of sending such messages.

The receiver

This aim is to display trace messages received from several running applications. It will associate to each application, its own trace child window and will identify it by a string like this:

machine [application description]

where machine is the computer where the sending application is running and application description is a short description of the application itself. All you have to do is to start this application and to set the port where you want to listen from senders. The implicit value is 7777 and it's not recommended to modify it, unless it's already used.

The sender

Using the COM

You may instantiate it by Version Independent ID Tracing.RuntimeTrace, or by importing directly from tracing.dll, which can be found in the system directory. It depends on the developing instrument you are using. The interface has several methods and a property:

BOOL SetTarget (Name[, IP[, Port]] )
  • Name - the string to identify the current application
  • IP - the IP of the machine running the receiver. Default: ""
  • Port - the port the receiver is listening. Must be the same value the receiver is listening

Attempts to connect the server and assigns a name to the sender application. Returns TRUE if successful, otherwise FALSE.

BOOL IsConnected ()

Returns TRUE if connected, otherwise FALSE.

BOOL Add (Var)
  • Var - The parameter to be added to the list

Adds a variable to the list to be traced. The order of calls must fit the order of the format text passed to the next Trace call. Returns TRUE if successful, otherwise FALSE.

VOID Drop()

Drops the content of the actual parameters list.

BOOL Trace(Format)
  • Format - the format text to be displayed by the receiver. Must be in printf (C function) style

Trace the list previously created with Add. Returns TRUE if successful, otherwise FALSE.

VOID Trace10(Format[, v1[, v2[...[, v10]]...])
  • Format - the format text to be displayed by the receiver
  • v1-v10 - at most 10 parameters to be traced

Trace the variables provided. Must be in printf (C function) style.


A text containing the reason of the last error

Using RTClass.h (C++/MFC) or RTClassC.h (C++/non MFC)

Contains a class with the equivalent members of the COM interface above.

The protocol

machine "application" text

where machine is the IP of the sender machine, application is the name chosen for the application and text is the text the sender wishes to send. Notice the use of " as syntax element.


  • March 31, 2003

    Unicode support added.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Hans Ruck
Software Developer (Senior)
Europe Europe
No Biography provided

You may also be interested in...

Comments and Discussions

Questionwell done! what about search feature? Pin
matro28-Jul-03 8:09
membermatro28-Jul-03 8:09 
AnswerRe: well done! what about search feature? Pin
Bogdan Rechi29-Jul-03 2:54
memberBogdan Rechi29-Jul-03 2:54 
GeneralRe: well done! what about search feature? Pin
matro31-Jul-03 22:16
membermatro31-Jul-03 22:16 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180515.1 | Last Updated 31 Mar 2003
Article Copyright 2002 by Hans Ruck
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid