Does Delphi have a function similar to debug.print in VB, and if it does, how does one access the immediate window? Thanks.
Asked
Active
Viewed 4,980 times
3
-
also : http://stackoverflow.com/q/4873356/327083, http://stackoverflow.com/q/397934/327083 ... – J... May 13 '13 at 17:10
-
What makes you think debug output has anything to do with the immediate window (which in Delphi is known as the [Evaluate/Modify](http://docwiki.embarcadero.com/RADStudio/XE4/en/Overview_of_Debugging#Evaluate.2FModify) window)? – Rob Kennedy May 13 '13 at 17:27
-
@Rob In VB Debug.Print does output to the immediate window – David Heffernan May 13 '13 at 17:38
-
Bizarre dupe selection. Write to the console window? Debug.Print? – David Heffernan May 13 '13 at 18:10
-
@DavidHeffernan I picked the first of many - there are a lot of equally awkward questions like this that are essentially looking for the functionality of `OutputDebugString` to the Event Log... awkward in that they all misuse some terminology or other to describe as much without actually knowing what to call it. – J... May 13 '13 at 19:06
-
@J... Marking it as a duplicate of a question that is completely different doesn't seem helpful to me. Pick a good duplicate – David Heffernan May 13 '13 at 19:07
-
1@DavidHeffernan the use case and feature need are basically identical. The only difference is in the wording - one guy is asking for "console" output, this guy is asking for an "immediate window". It seems clear that they are both looking for the standard thing that is *"that feature in this IDE whereby my application can output strings to a box such that I might monitor them whilst debugging"*. – J... May 13 '13 at 19:26
1 Answers
6
You can call the Windows API function OutputDebugString
. Anything that is sent to that function appears in the Event Log window in the IDE (View | Debug Windows | Event Log).

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
-
Or in third-party debug viewers, like [SysInternals DebugView](http://technet.microsoft.com/en-us/sysinternals/bb896647), which are useful when debugging outside of the IDE. – Remy Lebeau May 13 '13 at 17:37
-
@David, thanks! It really helps. I suppose it's only for string values? Can I print a value, eg enumerated type, to debug window as well? – user2378627 May 13 '13 at 17:53
-
Write a helper to convert other types to string and then call OutputDebugString. – David Heffernan May 13 '13 at 18:08
-
@Remy Lebeau, DbgView is not really a debugger. It will read debug strings from the processes **not** being debugged. – OnTheFly May 13 '13 at 18:46
-
-
@user539484: I never said DebugView was a debugger. But it does intercept and display debug messages from `OutputDebugString()` (and a few others). – Remy Lebeau May 13 '13 at 22:25