Fred, I think it would handy to have a "Save" button next to the
"Show Debug Window" checkbox, so that we can save the debug output
data to a text file if we need to. Hopefully you'll agree.

PB - Registered PureBasic Coder
Code: Select all
Procedure SaveDebugTextCallback(hWnd,Value)
ClassName$ = Space(100)
GetClassName_(hWnd,@ClassName$,100)
If ClassName$ = "ListBox"
Count = SendMessage_(hWnd,#LB_GETCOUNT,0,0)
If Count = 0
MessageRequester("DEBUG SAVE","No Data in Debug Output",#MB_ICONINFORMATION)
Else
If OpenFile(1,PeekS(Value))
FileSeek(Lof())
WriteStringN(";---[ New Entry ]-------")
GetLocalTime_(time.SYSTEMTIME)
WriteStringN("; - Date: "+StrU(time\wDay,1)+"."+StrU(time\wMonth,1)+"."+StrU(time\wYear,1))
WriteStringN("; - Time: "+StrU(time\wHour,1)+":"+StrU(time\wMinute,1))
For a = 0 To Count - 1
Length = SendMessage_(hWnd,#LB_GETTEXTLEN,a,0)
Text$ = Space(Length)
SendMessage_(hWnd,#LB_GETTEXT,a,@Text$)
WriteStringN(" | "+Text$)
Next a
WriteStringN(";---[ End Entry ]-------")
WriteStringN("")
CloseFile(1)
MessageRequester("DEBUG SAVE","Saved Debugger Output to:"+Chr(13)+PeekS(Value),#MB_ICONINFORMATION)
Else
MessageRequester("DEBUG SAVE","Couldnt save Debug Output",#MB_ICONERROR)
EndIf
EndIf
EndIf
ProcedureReturn 1
EndProcedure
Procedure SaveDebugOutput(File$)
hDebug = FindWindow_(0,"PureBasic - Debug Output")
If hDebug
EnumChildWindows_(hDebug,@SaveDebugTextCallback(),@File$)
Else
MessageRequester("DEBUG SAVE","Debugger Disabled!",#MB_ICONERROR)
EndIf
EndProcedure
; Code Start
SaveDebugOutput("c:\PB_DEBUG.TXT")
Debug "TEST"
Debug Str(12)+" PureBasic Debug"
Debug "testing..."
Debug 123456
SaveDebugOutput("c:\PB_DEBUG.TXT")