Writes to a debugging session a formatted message
#include <Debug.au3>
_DebugReportEx ( $sData [, $bLastError = False [, $bExit = False]] )
$sData | Data to be reported (e.g. "dllname|functionname") |
$bLastError | [optional] True if _WinAPI_GetLastErrorMessage() must be append to the data being reported |
$bExit | [optional] True if the script must be terminated |
Success: | 1 (see remarks). |
Failure: | 0. |
According to the @error flag value the message will be formatted as follow:
0 - report "Bad return from FUNCTION in DLL".
1 - report "unable to open a DLL"
3 - report "unable to find FUNCTION in DLL".
If $sData is does not contain a "|" or @error not as specified above the reported message will not be formated.
If no _DebugSetup() have been issued the function always returns.
@error of the caller is preserved.
@extended can be set to Windows API _WinNet_GetLastError() if $bLastError = True.
Otherwise it is preserved.
Each time _DebugReportEx() is called, the output is put on its own line.
#include <Debug.au3>
_DebugSetup()
_DebugOut("message1")
SomeUDF("anyfunction")
If @error Then _DebugReportEx("user32|anyfunction", True); with last error message appended
Local $iRet = SomeUDF("CloseClipboard")
If @error Or $iRet = 0 Then _DebugReportEx("user32|CloseClipboard")
_DebugOut("message2")
$iRet = SomeUDF("CloseClipboard")
If @error Or $iRet = 0 Then _DebugReportEx("user32|CloseClipboard", False, True) ; Script will be terminated
_DebugReport("message3") ; will not be reported
Func SomeUDF($sFunc)
Local $aResult = DllCall("user32.dll", "int", $sFunc)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[0]
EndFunc ;==>SomeUDF