Skip to content

Instantly share code, notes, and snippets.

@CarlTBarnes
Last active August 3, 2023 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarlTBarnes/d3c7a3779b094f0ed48186d04a9b45e6 to your computer and use it in GitHub Desktop.
Save CarlTBarnes/d3c7a3779b094f0ed48186d04a9b45e6 to your computer and use it in GitHub Desktop.
OutputDebugString wrapper for Clarion String
DB PROCEDURE(STRING xMsg)
Prfx EQUATE('Prefix: ')
sz CSTRING(SIZE(Prfx)+SIZE(xMsg)+3),AUTO
CODE
sz=Prfx & CLIP(xMsg) & '<13,10>'
OutputDebugString(sz)
!----------------------------------------
DB PROCEDURE(STRING xMessage)
Prfx EQUATE('PrefixText: ') !All output gets this
sz CSTRING(SIZE(Prfx)+SIZE(xMessage)+3),AUTO
CODE
sz = Prfx & CLIP(xMessage) & '<13,10>'
OutputDebugString( sz )
!----------------------------------------
DB PROCEDURE(STRING xMessage)
sz CSTRING(SIZE(xMessage)+3),AUTO
CODE
sz = CLIP(xMessage) & '<13,10>'
OutputDebugString( sz )
!----------------------------------------
MAP
DB(STRING DebugMessage) !OutputDebugString
DB PROCEDURE(STRING DebugMessage) !OutputDebugString
MODULE('WinAPI')
OutputDebugString(*cstring Msg),PASCAL,RAW,DLL(1),NAME('OutputDebugStringA')
END
!--------------------------------
DBClear PROCEDURE()
DbgClear CSTRING('DBGVIEWCLEAR') !Message to Clear the buffer. Must UPPER and first i.e. without a Prefix
CODE
OutputDebugString(DbgClear) !Cannot have Prefix, must be first .. so call API directly
! From: DiscussSV Clarion10 by Koen Tjoa on 6/27/2023, topic "Add output to debugview to ABFILE.CLW?"
! To turn it ON File Profile sent to Debug View
MyFile{PROP:Profile} = 'DEBUG:' ! Send to Debug View. Note Colon (:) at the end.
MyFile{PROP:Details} = True ! True = Driver to include Record Buffer contents **
MyFile{PROP:LogSQL} = True ! True = Turns ON logging of calls to the backend for SQL drivers
! To turn OFF:
MyFile{PROP:Profile} = ''
MyFile{PROP:Details} = False
MyFile{PROP:LogSQL} = False
Typically File{PROP:Profile}='LogFileName.Txt' i.e. the Log Disk File
Carl tested that this works in 10.12799, 11.0 and 11.1.
The Profile settings are Per Thread.
** PROP:Details - If Encrypted and SQL then must have ALLOWDETAILS in DRIVER('SQLDriver', '/ALLOWDETAILS=TRUE')
===============================
Clarion HUB: Trace.exe - turning off Logging
Post on March 18, 2023
https://clarionhub.com/t/trace-exe-turning-off-logging/1362/6
Code by Mark Goldberg
Profile:OutputDebugString EQUATE('Debug:')
CODE
SYSTEM{Prop:Profile} = Profile:OutputDebugString
Suggestion by Mark Sarson: If you are using UltimateDebug:
ud.TurnOnTracing(FileName)
ud.TurnoffTracing(FileName)
FileName being the file you want to target for tracing
Suggestion by Mark Riffey:
SYSTEM{PROP:DriverTracing} = '1' !enable all driver tracing
SYSTEM{PROP:Profile} = 'Debug:' !Send output to debugview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment