Jump to content

Recommended Posts

Posted

First, global replace &_ with & _

Then, on line 1 the RunErrorsFatal flag has been removed in favor of an @error setting. I haven't written an error handler yet.

Right now, it just fails without report. I don't know how much farther I'm going to precede with debugging this.

Just FYI.


Posted

Here is an example of retrieving the error message from an execution using Run().


; run a file that does not exist to produce error
Run('I-do-not-exist.exe')
; check error status
If @error And @extended Then
; get the error message
$message = _FormatMessage(@extended)
If Not @error Then
; show the error message
MsgBox(0, Default, $message)
EndIf
EndIf

Func _FormatMessage($iErrorcode)
; Finds the message definition in a message table resource
Local $lpBuffer, $sMessage
Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x1000
$lpBuffer = DllStructCreate('char[4096]')
If @error Then Return SetError(1, 0, '')
DllCall('kernel32.dll', 'int', 'FormatMessage', _
'int', $FORMAT_MESSAGE_FROM_SYSTEM, _
'ptr', 0, _
'int', $iErrorcode, _
'int', 0, _
'ptr', DllStructGetPtr($lpBuffer), _
'int', 4096, _
'ptr', 0)
If Not @error Then
$sMessage = DllStructGetData($lpBuffer, 1)
$lpBuffer = 0
Return $sMessage
Else
$lpBuffer = 0
Return SetError(2, 0, '')
EndIf
EndFunc

:)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...