I'm working on some code to integrate our Java system with a 3rd-party COM object. (Yeah, lots of fun.) The COM object is designed to be used in a very procedural style: all methods return a boolean indicating success and provide values using pass-by-reference. If the method fails, you can call the GetLastError method to see what went wrong. The documentation for that method:
What happens when you call GetLastError when GetLastError returns false is left as an exercise to the imagination.
GetLastErrorRetrieves the last error generated by the engine.
bReturnValue = CalcEngine.GetLastError(ErrorMsg)
ParametersbReturnValue Boolean/Integer: Returned as TRUE (integer = -1) when the operation is successful, and FALSE (integer = 0) when the operation fails. You can get the last error generated by invoking the GetLastError method.