Posted on 1999-01-23
I'm no expert at writing code at handling exceptions and this is basically my first attempt at it. Of course, I'm stumped right away! My app calls a 3rd party sort routine DLL in the form of an ActiveX control. Here's my code...
...Simple enough...I expected that any exception that occurred would cause my handling routine 'ckforsorterror' to be executed, but not so. As I step thru the code and come to Supersort1.sort, it steps into the code unit of the SuperSort ActiveX control module, and while in there generates the EOleException...and the program aborts...never reaching my 'cksorterror' procedure.
What's happening here? How can I get my 'cksorterror' procedure to handle the exceptions from this sort routine? The author of the sort routine does not know Delphi, but he gave me examples of how to handle the exception in VB and VC++. Here's what he wrote:
I cannot recall the exact Delphi procedure for handling exceptions, but
in Visual Basic you would write something like this:
On Error GoTo Handler
' If everything is OK, simply return from the function
dim error as Long
' Get the last error code from Supersort
error = Supersort1.GetError
' This error indicates an empty input file.
' If this is OK, do nothing and return success!
if error = 20019
In C++, you would write something like this
long error = Supersort1.GetError()
if (error == 20019) return SUCCESS;
// Another error was raised, handle it
...this VC++ code kinda looks like how it would be handled in Delphi...but somethings not working right. Is there some compiler directive that I'm missing somewhere? It's probably something real simple that I'm just overlooking.