Microsoft DirectX 9.0

Debug Output Functions

The Microsoft® DirectShow® base classes provide several macros for displaying debugging information.


Header: Declared in Wxdebug.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Function Description
DbgCheckModuleLevel Checks whether logging is enabled for the given message types and level.
DbgDumpObjectRegister Displays information about active objects.
DbgInitialise Initializes the debug library.
DbgLog Sends a string to the debug output location, if logging is enabled for the specified type and level.
DbgOutString Sends a string to the debug output location.
DbgSetModuleLevel Sets the logging level for one or more message types.
DbgTerminate Cleans up the debug library.
DisplayType Sends information about a media type to the debug output location.
DumpGraph Sends information about a filter graph to the debug output location.
GuidNames Global array that contains strings representing the GUIDs defined in Uuids.h.
NAME Generates a debug-only string.
NOTE Sends a string to the debug output location.
REMIND Generates a reminder at compile time.


The debugging facilities in DirectShow can be fine-tuned to display specific types of debug information, while ignoring others. With this feature, you can pinpoint problems in particular areas of your code. DirectShow defines several message types, shown in the following table.

Value Description
LOG_ERROR Error notification.
LOG_LOCKING Locking and unlocking of critical sections.
LOG_MEMORY Memory allocation, and object creation and destruction.
LOG_TIMING Timing and performance measurements.
LOG_TRACE General call tracing.
CUSTOM1 through CUSTOM5 Available for custom debug messages

Each of the DirectShow debug logging functions specifies a message type and a log level. The debug message is displayed only when the current debugging level for that message type is equal to or greater than the level specified in the logging function. Otherwise, the message is ignored.

For example, the following code outputs the string "This is a debug message" if the LOG_TRACE level is 3 or higher:

DbgLog((LOG_TRACE, 3, TEXT("This is a debug message")));

Every module can set its own debugging level for each message type. (A module is a DLL or executable that can be loaded using the Microsoft® Win32® LoadLibrary function.) A module's debugging levels appear in the registry under the following key:

\HKEY_LOCAL_MACHINE\SOFTWARE\Debug\<Module Name>\<Message Type>

where <Message Type> is the message type minus the initial "LOG_"; for example, LOCKING for LOG_LOCKING messages. When a module is loaded, the debug library finds the module's logging levels in the registry. If the registry keys do not exist, the debug library creates them.

A module can also set its own levels at run time, using the DbgSetModuleLevel function. To send a message to the debug output, call the DbgLog macro. The following example creates a level 3 message of type LOG_TRACE:

You can also specify global logging levels, with the following registry key:


The debug library uses whichever level is greater, the global level or the module level.

Debug Output Location

The debug output location is determined by another registry key:


If the value of this key is Console, the output goes to the console window. If the value is Deb, Debug, Debugger, or an empty string, the output goes to the debugger window. Otherwise, the output is written to a file specified by the registry key.

Before an executable uses the DirectShow debug library, it must call the DbgInitialise function. Afterward, it must call the DbgTerminate function. DLLs do not need to call these functions, because the DLL entry point (defined in the base class library) calls them automatically.