Can we programmatically close the Debug Window?

Just starting out? Need help? Post your questions and find answers here.
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Can we programmatically close the Debug Window?

Post 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.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Can we programmatically close the Debug Window?

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Can we programmatically close the Debug Window?

Post 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:
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Can we programmatically close the Debug Window?

Post 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. :(
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: Can we programmatically close the Debug Window?

Post 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
The best preparation for tomorrow is doing your best today.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Can we programmatically close the Debug Window?

Post 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()
BERESHEIT
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Can we programmatically close the Debug Window?

Post by skywalk »

Very nice KJ67(and ts-soft's AutoWin) and netmaestro!

Adding this to my Tool code :D
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Can we programmatically close the Debug Window?

Post 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.
Post Reply