Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
MapleTrapError - trap a Maple error in external code
Calling Sequence
MapleTrapError(kv, f, data, err)
Parameters
kv
-
kernel handle returned by StartMaple
f
function pointer
data
integer data
err
boolean flag set to True if an error occurs executing f
Description
This function is part of the OpenMaple interface to Microsoft Visual Basic.
The MapleTrapError function attempts to execute the VB function f(data). If a Maple error is raised at any time during execution of f, the function returns immediately after setting err to True.
Use the GetProc and AddressOf commands to get the address of a VB function as shown in the example below.
This function can be used to abort function calls when MapleRaiseError is invoked.
Examples
dim global_kv as long
Public Function TestTrapErrorCB1(data As Long) As Long
MapleRaiseError global_kv, "test"
TestTrapErrorCB1 = data
End Function
Public Function TestTrapErrorCB2(data As Long) As Long
TestTrapErrorCB2 = EvalMapleStatement(global_kv, "int(x,x):")
Public Sub TestTrapError(ByVal kv As Long)
Dim errorflag As Long
Dim data As Long
global_kv = kv
data = MapleTrapError(kv, GetProc(AddressOf TestTrapErrorCB1), _
365, errorflag)
If errorflag = 0 Then
MsgBox "should have been an error (errorflag = 1)", _
vbInformation, ""
End If
data = MapleTrapError(kv, GetProc(AddressOf TestTrapErrorCB2), _
0, errorflag)
If errorflag = 1 Then
MsgBox "should NOT have been an error (errorflag = 0)", _
vbInformation, """"
End Sub
See Also
error, OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, traperror(deprecated)
Download Help Document