Page 1 of 1

Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 6:24 pm
by Zach
I am using the Debug window to see feedback during testing of my compilations, but what is really annoying is even when I close the compilation program, the debug window stays open.

I guess I could just kill it by using the red X icon in the IDE, but that doesn't feel "proper".. Is it possible to close the debug window with an Event?

Would be nice if this was taken care of as part of PB's cleanup routine, when an application ends.

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 6:27 pm
by IdeasVacuum
Nooooo! It is valuable to be able to study the debug output - should be the Developer that decides when to close the Window, not PB.

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 7:25 pm
by Zach
While I do value your opinion, that doesn't answer my question!

Is there any way I can tell PB to close the Window when my program exits? It is of no use to me when the program is not running, and is just an added annoyance to have to close it manually after every test run :cry:

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 7:40 pm
by skywalk
+1
I would use this if I could automate it via a Tool.
I am staring at dozens of open debug and variable viewer windows. :(

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 7:48 pm
by KJ67
Just put something like below that you can launch via the toolbar.

Code: Select all

Define txt$

Restore WindowNames
Repeat
  Read.s txt$
  txt$ + " -"
  If txt$ = " -": Break: EndIf
  If AW_WinExists(txt$)
    AW_WinMove(txt$, $1FFFF, $1FFFF) ; Try to avoid any animation
    AW_WinClose(txt$)
  EndIf
ForEver

DataSection
  WindowNames:
  Data.s  "Asm Debugger", "Data Breakpoints", "Debug Output", "Library Viewer", "Memory Viewer"
  Data.s  "Procedure Callstack", "Profiler Settings", "Profiler", "Purifier Settings"
  Data.s  "Variable Viewer", "Watch List", ""
EndDataSection

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 7:54 pm
by netmaestro

Code: Select all

Procedure DebugKiller(hwnd, lparam)
  wt$ = Space(256)
  GetWindowText_(hwnd, @wt$, 255)
  If FindString(wt$, "Debug Output -")
    SendMessage_(hwnd, #WM_CLOSE, 0,0)
    ProcedureReturn 0
  Else
    ProcedureReturn 1
  EndIf
EndProcedure

Procedure KillDebugWindow()
  EnumWindows_(@DebugKiller(),0)
EndProcedure

Debug "We'll wait a second..."

Delay(1000)

KillDebugWindow()

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 8:00 pm
by skywalk
Very nice KJ67(and ts-soft's AutoWin) and netmaestro!

Adding this to my Tool code :D

Re: Can we programmatically close the Debug Window?

Posted: Wed Sep 21, 2011 9:30 pm
by Zach
Netmaestro,

Thanks so much for your code. It is small, clean and concise. It now has a home in my first *.pbi file, in my brand new "Helpful Utility Includes" directory.