Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OutputDebugString() support?

19 views
Skip to first unread message

Jeremy Nicoll - news posts

unread,
Jan 4, 2010, 9:24:40 PM1/4/10
to
I recently found out that in, say, VB programs, one can include the simple
declaration:

Private Declare Sub OutputDebugString Lib "kernel32" _
Alias "OutputDebugStringA" (ByVal lpOutputString As String)

or perhaps

Private Declare Sub Dbg Lib "kernel32" _
Alias "OutputDebugStringA" (ByVal lpOutputString As String)


These lines do very nearly the same thing. They tell VB that it's to
recognise anything you type as

OutputDebugString (the first example)

or

Dbg (the second example)


as a function name in your program.


When you use the declared function VB will call on your behalf the function
(in the windows kernel) named "OutputDebugStringA" (the trailing A means it
supports plain ASCII strings rather than Unicode). The result is that when
you then do:

OutputDebugString ("This is a message from a word macro.")

or: Dbg ("blah blah blah")

the relevant bit of text is sent to join any other debug text issued from
other apps or Windows itself.

Even if one doesn't have a full-blown debugger, one can run something like
DebugView from SysInternals (now part of Microsoft) which will trap all the
debug texts, allow you to filter them, highlight them in pretty colours, and
perhaps most usefully of all it can archive all those debug texts into files
on a one-off or rolling day-to-day basis.


This would of course be very useful in rexx execs... I'd like to think that
since the way to tell VB that the function exists is simple, that it'd be
possible to do this in ooRexx too.

Is it though?

Alternatively (though it seems madly inefficient) does anyone have a program
(not VB, I could do that myself I think) which could be run from the windows
commandline like:

C:\blah\ODS jdkfvdss kdfh kdfh kdhf dkf hdkfh dkfh

which would write the line concerned to the debug data stream?


--
Jeremy C B Nicoll - my opinions are my own.

Email sent to my from-address will be deleted. Instead, please reply
to newsre...@wingsandbeaks.org.uk replacing "nnn" by "284".

0 new messages