首页  编辑  

调试程序输出信息

Tags: /超级猛料/IDE.集成开发环境/编译、调试/   Date Created:

Debugging with message logging

There may be some circumstances, you want to debug your application, but you don't want to interrupt the program flow with a breakpoint. By using "ShowMessage" calls, you have to press the OK button each time and you will change the focus from the active control to the message dialog. There is an easy possibility to write log entries, which you can view in the "event log" of the Delphi IDE.

uses Windows;

////////////////////////////////////////////////////////////////

// sends a message to a debugger without interrupting the program

// flow. normally, the debugger will be the delphi IDE, you can

// view the messages in the "event log".

procedure Sto_DebugLog(const Msg: String);

begin

 {$IFOPT C+} // only to compile, if assertions are "on"

 OutputDebugString(PChar(Msg));

 {$ENDIF}

end;