Win32 output debugging
-
An alternative way for debugging on Windows machines using Win32API.so.
You need a system debug viewer running such as DebugView and output goes to the debugger window. Also,
@unknownuser said:
If the application has no debugger and the system debugger is not active, OutputDebugString does nothing.
This could also be used with Al's trace ruby messages technique so instead of output going to files ,it goes to the debugger.
Come to think of it, something like this should be part of the api.
OutputDebugString = Win32API.new("kernel32.dll", "OutputDebugString", ['P'], 'V') def opd(s="\0") s = s.to_s + "\0" OutputDebugString.call(s) end opd(Time.now)
-
This is excellent!
@jim said:
Come to think of it, something like this should be part of the api.
Double Plus Good!
-
How would I use this Jim? I add that code to a script while I'm writing it. And do do what with it? It just does everything on its own?
-
In DebugView, you can clear the debugger window by outputting the string "DBGVIEWCLEAR"
-
Jim: are you working for Render Plus now ?
-
I think this thread should be sticky... or in the sticky thread...
-
It turns out this OutputDebugString example is straight out of the Pickaxe book.
-
class CL_rps_console < Sketchup::Console
Sketchup::Console
-
Here's what I came up with. Just make sure it is alphabetically the first file in Plugins in order to capture the earliest output.
require 'Win32API' class CL_rps_console < Sketchup;;Console OutputDebugString = Win32API.new("kernel32.dll", "OutputDebugString", ['P'], 'V') def write(smess="\0") smess = smess.to_s + "\0" OutputDebugString.call(smess) end end # redefine standard output to our new class $old_stdout = $stdout # in case you want to turn off traces $stdout = CL_rps_console.new $stderr = $stdout puts "-" * 40 puts Time.now puts "Starting SketchUp" puts "-" * 40
Advertisement