gpt4 book ai didi

delphi - 如何查看OutputDebugString的输出?

转载 作者:行者123 更新时间:2023-12-03 14:39:13 26 4
gpt4 key购买 nike

我想在我的应用程序中使用 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.

我已经阅读了文档,无济于事,并且看到其他人也有类似的问题,但没有发布解决方案。

有解决办法吗?

最佳答案

DebugView工具工作正常;只需确保直接启动您的应用程序(不附加 Delphi IDE 或其他调试器)。

无论如何,查看 OutputDebugString 的自然方式Delphi 应用程序的输出是使用 Delphi IDE 和事件日志窗口。

Enter image description here

Enter image description here

关于delphi - 如何查看OutputDebugString的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11218434/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com