Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
First non-visual class
Message
From
15/04/2002 16:15:52
 
 
To
15/04/2002 16:09:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00645175
Message ID:
00645182
Views:
14
>>Hi,
>>
>>I'm getting this error trying to instantiate a customer lookup class... This code worked Friday. Can anybody tell me what this message means and /or a good way to debug a non-visual class? I tried creating a log, but since the object's never created, the log never gets built...
>>
>>OLE error code 0x80040111: ClassFactory cannot supply requested class.
>>
>>TIA
>
>This error messages looks to me like you try to instantiate an object external to VFP, like Excel, etc. What is the command for instantiating?
>
>Hilmar.

Here's the actual code (the attempts at logging never fired). Thanks for your prompt reply!


DEFINE CLASS CustData AS SESSION OLEPUBLIC
* Returns one of the following:
* - customer(s) in a user-defined output format (XML is the default)
* - an XML message in case of error
*
clsQueryString = ""
clsOutputType = "XML"
oX1Y1 = .NULL.
*
PROCEDURE INIT
THIS.oX1Y1 = CREATEOBJECT( 'Crypto.Crydec' )
*
SET SAFE OFF
SET DELETED ON
*
* we need a 'temp' directory
cOldError = ON ("ERROR")
ON ERROR lError = .T.
MD C:\TEMP
ON ERROR &cOldError
*
SET ALTERNATE TO C:\TEMP\CustData.LOG
SET ALTERNATE ON
SET CONSOLE OFF
? "CustData.DLL log file " + DTOC( DATE() )
?
? "Start----------------------"
ENDPROC
*
PROCEDURE GetCust( pQueryString, pOutputType )

LOCAL cResults, xResults, cWhere, cCCACust, cCCSCust
*
cCCACust = "U:\CCSOFT\DATA\CUSTOMERS"
cCCSCust = "K:\CCSOFT\DATA\CUSTOMERS"
*
* verify that customer tables are available

? 'log - 1'

IF ! ( FILE( cCCACust ) AND FILE ( cCCSCust ) )
? 'log - 2'
* customer files not available
CREATE TABLE C:\TEMP\cResults ( ERRORMSG M )
INSERT INTO cResults (ERRORMSG) VALUES ("Customer table is not available" )
=CURSORTOXML( "cresults", "xresults", 3 )
RETURN xResults
ELSE
? 'log - 3'

*
* change default output?
IF PCOUNT() = 1
ELSE
THIS.clsOutputType = pOutputType
ENDIF
*
* grab the data
nEqPos = AT( "=", pQueryString )
cQField = ALLTRIM( SUBSTR( pQueryString, 1, nEqPos - 1) )
cQVal = ALLTRIM( SUBSTR( pQueryString, nEqPos + 1 ) )
? 'log - 4'
DO CASE
CASE cQField = "MEMBERNO"
? 'log - 5'
cWhere = "ALLTRIM(MEMBERNO)=cQVal"
cOrderBy = "MEMBERNO"
CASE cQField = "ACCOUNT"
? 'log - 6'
cWhere = "ACCOUNT=cQVal"
cOrderBy = "ACCOUNT"
CASE cQField = "NAME"
? 'log - 7'
* parse the name
IF !EMPTY(cQVal)
? 'log - 8'
lcInputVal=ALLTRIM(cQVal)
IF AT(',',lcInputVal)>0
? 'log - 9'
lcNameKey=THIS.oX1Y1.fldencrypt(PADR(LEFT(lcInputVal,AT(',',lcInputVal)-1),25))+;
THIS.oX1Y1.fldencrypt(ALLTRIM(SUBS(lcInputVal,AT(',',lcInputVal)+1)))
ELSE
? 'log - 10'
lcNameKey=THIS.oX1Y1.fldencrypt(lcInputVal)
ENDIF
ENDIF
? 'log - 11'
cWhere = "LASTNAME+FIRSTNAME=lcNameKey"
cOrderBy = "LASTNAME,FIRSTNAME"
OTHERWISE
? 'log - 12'
* invalid query string
CREATE TABLE C:\TEMP\cResults ( ERRORMSG M )
INSERT INTO cResults (ERRORMSG) VALUES ("Invalid query string." + CHR(13) + CHR(13) + ;
"The query received was [" + pQueryString + "]. A proper query must match one of these examples:" + CHR(13) + CHR(13) + ;
[- MEMBERNO=1234567] + CHR(13) + ;
[- ACCOUNT=1234567890123456] + CHR(13) + ;
[- NAME=SMITH, JOHN] )
=CURSORTOXML( "cresults", "xresults", 3 )
RETURN xResults
ENDCASE
*
* output the data
SELECT ;
DATEOFSALE, ;
MEMBERNO, ;
ACCOUNT, ;
THIS.oX1Y1.flddecrypt(FIRSTNAME) AS FIRSTNAME, ;
THIS.oX1Y1.flddecrypt(LASTNAME) AS LASTNAME , ;
THIS.oX1Y1.flddecrypt(ADDRESS) AS ADDRESS , ;
THIS.oX1Y1.flddecrypt(CITY) AS CITY , ;
THIS.oX1Y1.flddecrypt(STATE) AS STATE , ;
THIS.oX1Y1.flddecrypt(ZIP) AS ZIP ;
FROM ( cCCACust ) ;
WHERE &cWhere ;
INTO CURSOR CustData ;
ORDER BY &cOrderBy
? 'log - 13'
DO CASE
CASE THIS.clsOutputType = "XML"
? 'log - 14'
=CURSORTOXML( "CustData", "xResults", 1, 4, 0, "1" )
RETURN xResults
*!* CASE clsOutputType = "XLS"
*!* CASE clsOutputType = "DBF"
*!* CASE clsOutputType = "TXT"
*!* CASE clsOutputType = "CSV"
*!* CASE clsOutputType = "RS"
OTHERWISE
? 'log - 15'
*
* unsupported output format
CREATE TABLE C:\TEMP\cResults ( ERRORMSG M )
INSERT INTO cResults (ERRORMSG) VALUES ("Unsupported output format." + CHR(13) + CHR(13) + ;
"XML is the only format currently supported" )
=CURSORTOXML( "cresults", "xresults", 3 )
RETURN xResults
ENDCASE
ENDIF
ENDPROC
*
PROCEDURE DESTROY
? 'log - 16'
WITH THIS
ENDWITH
ENDPROC
*
FUNCTION ERROR( nError, cMethod, nLine)
? 'log - 17'
COMRETURNERROR( cMethod+' err#='+STR(nError,5)+;
' line='+STR(nLine,6)+' '+MESSAGE(),_VFP.SERVERNAME)
ENDFUNC
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform