【发布时间】:2012-06-27 02:04:56
【问题描述】:
我想在我的应用程序中使用OutputDebugString(),然后可以选择在现场部署应用程序时在单独的查看器中显示它。
也就是说,我不想改变一个标志并重建我的 .exe 来打开和关闭调试。
谷歌搜索,似乎DebugView 应该处理这个问题,但它和TraceTool 都没有显示此代码的任何输出。
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.
我已经阅读了文档,但无济于事,并且看到其他人也遇到过类似的问题,但没有发布解决方案。
有解决办法吗?
【问题讨论】:
-
GExperts 有一个调试查看器和一个您添加到应用程序的单元,即使在 XE2 启动器中也可以为您执行此操作。请参阅
DebugIntf单元和它包含的GExpertsDebugWindow.exe应用程序。这些在 XE2 Starter(以及几乎所有其他版本的 Delphi)下工作。 -
这就是我写这个 DbWinUnit 的原因:bo.codeplex.com/SourceControl/changeset/view/78543#1494219 它允许您使用 OutputDebugString(由当前运行的调试器捕获)和使用 DBWIN 协议编写,这样 DebugView 也可以捕获输出。
-
@Mawg,完成。很高兴我能帮助你。 :-)
标签: delphi debugview outputdebugstring