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::ConsoleSketchup::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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement