'ON ERROR GOTO ERRHANDLE
'ERRHANDLE:
'IF ERR THEN
' IF _INCLERRORLINE THEN
' CriticalError ERR, _INCLERRORLINE, _INCLERRORFILE$
' RESUME NEXT
' ELSE
' CriticalError ERR, _ERRORLINE, ""
' RESUME NEXT
' END IF
'END IF
Const MB_OK
= 0 'OK button only Const MB_YESNO
= 4 'Yes & No Const MB_ICONSTOP
= 16 'Error stop sign icon Const MB_ICONEXCLAMATION
= 48 'Exclamation-point icon Const MB_SETFOCUS
= 65536 'Set message box as focus Const IDOK
= 1 'OK button pressed Const IDYES
= 6 'Yes button pressed Const IDNO
= 7 'No button pressed
Answer
= MessageBox
(0, message
+ Chr$(0), title
+ Chr$(0), MB_OK
+ MB_SETFOCUS
+ MB_ICONEXCLAMATION
)
Const MB_OK
= 0 'OK button only Const MB_YESNO
= 4 'Yes & No Const MB_ICONSTOP
= 16 'Error stop sign icon Const MB_ICONEXCLAMATION
= 48 'Exclamation-point icon Const MB_SETFOCUS
= 65536 'Set message box as focus Const IDOK
= 1 'OK button pressed Const IDYES
= 6 'Yes button pressed Const IDNO
= 7 'No button pressed
message
= "The program ran into a problem that it couldn't handle." + Chr$(10) + "Error Code: " + LTrim$(Str$(ERRR
)) + Chr$(10) + Chr$(10) + _ErrorMessage$
+ " on line " + LTrim$(Str$(ERRLINE
)) message = message + " in " + INCL
message = message + " in main module"
message
= message
+ Chr$(10) + "For more information about this issue and possible fixes, visit https://www.qb64.org/forum" + Chr$(10) + "Continue?" Answer
= MessageBox
(0, message
+ Chr$(0), "Error: " + LTrim$(Str$(ERRR
)) + Chr$(0), MB_YESNO
+ MB_SETFOCUS
+ MB_ICONSTOP
)
Const MB_OK
= 0 'OK button only Const MB_YESNO
= 4 'Yes & No Const MB_ICONSTOP
= 16 'Error stop sign icon Const MB_ICONEXCLAMATION
= 48 'Exclamation-point icon Const MB_SETFOCUS
= 65536 'Set message box as focus Const IDOK
= 1 'OK button pressed Const IDYES
= 6 'Yes button pressed Const IDNO
= 7 'No button pressed
Const FORMAT_MESSAGE_ALLOCATE_BUFFER
= &H00000100 Const FORMAT_MESSAGE_FROM_SYSTEM
= &H00001000 Const FORMAT_MESSAGE_IGNORE_INSERTS
= &H00000200 Const LANG_NEUTRAL
= &H00 Const SUBLANG_DEFAULT
= &H01 $If OFFSETTOSTRING
= UNDEFINED
Then $Let OFFSETTOSTRING
= TRUE
ERRR = GetLastError
msg
= FormatMessage
(FORMAT_MESSAGE_ALLOCATE_BUFFER
Or FORMAT_MESSAGE_FROM_SYSTEM
Or FORMAT_MESSAGE_IGNORE_INSERTS
, 0, ERRR
, MAKELANGID
(LANG_NEUTRAL
, SUBLANG_DEFAULT
), _Offset(lpMsgBuf
), 0, 0) ERRMSG = offset_to_string(lpMsgBuf)
message
= "The program ran into a problem in function " + additionalInfo
+ Chr$(10) message
= "The program ran into a problem that it couldn't handle." + Chr$(10) message
= message
+ "Error Code: " + LTrim$(Str$(ERRR
)) + Chr$(10) + Chr$(10) + ERRMSG
+ Chr$(10) + "For more information about this issue and possible fixes, visit https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes" message = message + "--0-499-"
message = message + "--500-999-"
message = message + "--1000-1299-"
message = message + "--1300-1699-"
message = message + "--1700-3999-"
message = message + "--4000-5999-"
message = message + "--6000-8199-"
message = message + "--8200-8999-"
message = message + "--9000-11999-"
message = message + "--12000-15999-"
message
= message
+ Chr$(10) + Chr$(10) + "Continue?" Answer
= MessageBox
(0, message
+ Chr$(0), "Error: " + LTrim$(Str$(ERRR
)) + Chr$(0), MB_YESNO
+ MB_SETFOCUS
+ MB_ICONSTOP
)