Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
outputdebugstring (kernel32)
.
Summary
Sends a string to the debugger for display.
C# Signature:
[DllImport("kernel32.dll")]
static extern void OutputDebugString(string lpOutputString);
VB.NET Signature:
<DllImport("kernel32.dll")> _
Shared Sub OutputDebugString(ByVal lpOutputString As String)
End Sub
Or (as in VB 6)
Public Declare Sub OutputDebugString Lib "kernel32" Alias _
"OutputDebugStringA" (ByVal lpOutputString As String)
User-Defined Types:
None.
Notes:
None.
Tips & Tricks:
Get DebugView here (http://www.sysinternals.com/Utilities/DebugView.html ) to display the output of OutputDebugString .
This C# example extends the OutputDebugString(...) with variable arguments:
public static void OutputDebugStringVarArg(
string format,
params object[] args)
{
try
{
OutputDebugString(string.Format(format, args));
}
catch (Exception)
{
return;
}
}
Now run the function as follows: OutputDebugStringVarArg("It is {0} past {1}", new object[] {5,10 });
Get OutputDebugString function implementation that accepts variable number of arguments like printf here (http://www.go4expert.com/forums/showthread.php?t=871 )
Sample Code:
1. Create a new C# windows console application project.
2. Add the following
using System.Runtime.InteropServices;
below
using System.Text;
3. Add the following as the first statement of the main function.
OutputDebugString("OutputDebugString Successfully executed");
Now execute the program with DebugView Open
Alternative Managed API:
System.Diagnostics.Debug.WriteLine
System.Diagnostics.Debugger.Log
Documentation
The OutputDebugString API
12/13/2010 4:58:23 AM - -79.253.13.144
The OutputDebugString API
12/13/2010 4:58:23 AM - -79.253.13.144
The OutputDebugString API
12/13/2010 4:58:23 AM - -79.253.13.144
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).