Each property and method listed in the automation model will return one of the following results upon execution. The exact meaning is described in the Execution Result section for each property or method.
Execution Result |
Cicode |
VBA |
C++ |
---|---|---|---|
InvalidArgument |
274 |
5 |
E_INVALIARG |
GeneralFailure |
356 |
2147500037 |
E_FAIL |
PathNotFound |
356 |
76 |
STG_E_PATHNOTFOUND |
Success |
0 |
- |
S_OK |
Errors are captured differently in Cicode and VBA. The following code examples show how to trap and handle errors in VBA and Cicode.
[VBA]
Sub VBATest(myObject As Object)
On Error Goto errHandler
myObject.<function>
Exit Sub
errHandler:
Print Err.Number, Err.Description
Resume Next
End Sub
[Cicode]
FUNCTION Test1(OBJECT hObject)
ErrSet(1); // Enable User error checking (disabled HW alarm)
IF ObjectIsValid(hObject) THEN
_ObjectCallMethod(hObject, "<function>");
error = IsError();
errorMessage = IntToStr(error)
IF (error <> 0) THEN
Message("An error occured", errorMessage, 0);
END
END
ErrSet(0); // Enable hardware alarm reporting of errors
END