title: How to view output of OutputDebugString?
body: <p>I want to use <code>OutputDebugString()</code> in my application and then have the option to show it in a separate viewer when the application is deployed in the field.</p>
  
  <p>That is to say, I don't want to have to change a flag and rebuild my .exe to turn debugging on and off.</p>
  
  <p>Googling around, it seems like <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="nofollow noreferrer">DebugView</a> should handle that, but neither it, nor <a href="http://www.codeproject.com/Articles/5498/TraceTool-12-4-The-Swiss-Army-Knife-of-Trace" rel="nofollow noreferrer">TraceTool</a> show any output from this code.    </p>
  
  <pre><code>unit Unit1;
  
  interface
  
  uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  
  type
    TForm1 = class(TForm)
      procedure FormCreate(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    Form1: TForm1;
  
  implementation
  
  {$R *.dfm}
  
  
  procedure TForm1.FormCreate(Sender: TObject);
  begin
     OutputDebugString(PChar('Hello, wurld'));
  end;
  
  end.
  </code></pre>
  
  <p>I have read the documentation, to no avail, and see that others have had similar problems, but have not posted a solution.</p>
  
  <p>Is there a solution?</p>