Article ID: 187909
Article Last Modified on 3/1/2005
DEFINE CLASS sampclass AS custom OLEPUBLIC
Name = "sampclass"
Procedure Init
*!* Turn on unattended mode as early as possible.
SYS(2335,0)
ENDPROC
PROCEDURE GenDisp
*!* Display some type of UI, this could be anything from an error
*!* message to a dialog box caused by an ODBC Logon.
WAIT WINDOW "test"
ENDPROC
PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
*!* Trap error and return the error message to client.
returnstr = ALLTRIM(STR(nError)) + ': "'+MESSAGE()+'" on Line ' ;
+ALLTRIM(STR(nline))
ComReturnError(cMethod,returnstr)
ENDPROC
ENDDEFINE
To build this code, create a project and name it MySample. Copy and paste
this code into a .prg file and add it to the project. Build the project as
an EXE. To run the sample code from the Command window, issue the
following:
oX = Createobject("MySample.sampclass")
oX.GenDisp()
A Dialog box should display stating the 2031 error number, message, and
line number where the error occurs.
Additional query words: kbvfp600
Keywords: kbhowto KB187909