You know those obnoxious error messages you get that say "OLE IDispatch exception code blah, blah, blah?" Well, now you don't just have to be the poor hapless recipient of them—you can create your own and share the fun with others!
COMReturnError( cServerName, cErrorDescription )|
Parameter |
Value |
Meaning |
|
cServerName |
Character |
This string is returned in the error message and should describe your software. |
|
cErrorDescription |
Character |
This string is returned in the error message after cServerName. |
Use this function to generate errors in your custom COM servers. The function works only within COM components, and generates a "Feature not available" error if executed in normal code or from the Command Window. The error generated is always error 1429, and if no error handler is in place, the error is displayed as "OLE IDispatch exception code <number> from cServerName: cErrorDescription." In VFP 6, this number is 0, but in VFP 7, it was changed to 1000. If you do have an error handler in place, you can use the AERROR() function to get more information in order to handle the error appropriately.
COMReturnError("MyServer","MyErrorGenerator")AError(), CreateObject(), CreateObjectEx(), Error Event, On Error

