Hello,
I have created a DLL in VFP7 that I call from a C# application. Normally it works fine. The problem I'm having is when there is an error in the DLL, the message returned to C# is meaningless.
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
I set up an "on error" handler that calls a procedure that writes out the actual error to a text file from the VFP dll, but then the C# program continues on without knowing there was an error.
How do I return something that indicates there was an error in the VFP DLL (like a -1).
Thanks for your help.
I have created a DLL in VFP7 that I call from a C# application. Normally it works fine. The problem I'm having is when there is an error in the DLL, the message returned to C# is meaningless.
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
I set up an "on error" handler that calls a procedure that writes out the actual error to a text file from the VFP dll, but then the C# program continues on without knowing there was an error.
How do I return something that indicates there was an error in the VFP DLL (like a -1).
Thanks for your help.
Code:
ON ERROR do errorproc with ERROR(), PROGRAM(), LINENO(), MESSAGE(), MESSAGE(1)
do some stuff
SELECT * from tablethatdoesnotexist ** cause error
RETURN countofrecords
PROCEDURE ERRORPROC
LPARAMETERS nError, cMethod, nLine, cMessage, cMessage1
LOCAL LnErrorHandle
LnErrorHandle=FCREATE('c:\error.txt')
IF LnErrorHandle>0
=FPUTS(LnErrorHandle,'Error Number:'+TRANSFORM(nError))
=FPUTS(LnErrorHandle,'Name of Method:'+cMethod)
=FPUTS(LnErrorHandle,'Line number:'+TRANSFORM(nLine))
=FPUTS(LnErrorHandle,'Message:'+cMessage)
=FPUTS(LnErrorHandle,'Message(1):'+cMessage1)
ENDIF
=FCLOSE(LnErrorHandle)
countofrecords = -1
ENDPROC