_UserError( ) API Library Routine

Reports an error with the null-terminated text you specify in message.

void _UserError(char FAR *message)
char FAR *message;         /* Error message. */

Remarks

The Visual FoxPro internal code for this error is 98. The code returned by the Visual FoxPro ERROR( ) function is 1098. The Visual FoxPro MESSAGE( ) function returns to the user your specified message. Control is passed to the Visual FoxPro error handler and doesn't return.

Note   Do not call _UserError( ) in a CALLUNLOAD routine: the library will not load, due to the _UserError( ) call, and no message will be displayed.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example calls _UserError( ), demonstrating that execution doesn't return to the API routine after _UserError( ).

Visual FoxPro Code

SET LIBRARY TO EXAMPLE
= EXAMPLE()

C Code

#include <pro_ext.h>

FAR UserErrorEx(ParamBlk FAR *parm)
{
   _UserError("This is a _UserError() example.");
   _PutStr("This should never be displayed.");
}

FoxInfo myFoxInfo[] = {
   {"EXAMPLE", (FPFI) UserErrorEx, 0, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_Error( ) API Library Routine | _ErrorInfo( ) API Library Routine | ERROR( ) Function | MESSAGE( ) Function | Accessing the Visual FoxPro API