>Learning how to make a VFP7 COM server (EXE), I create a custom class acts as the server.
>The server class has a method named GETSTRU:
>PARAMETERS aTableStru
>USE \\myserver\public\data\Items NOUPDATE
>=AFIELDS( aTableStru)
>USE
>
>The Init method of client form contains:
>DIMENSION aTableStru[1]
>aTableStru= 'ANYTHING'
>COMARRAY( oServer,11)
>oServer.GetStru( @aTableStru) && oServer object is created on Load method
>CREATE CURSOR LocalTbl FROM ARRAY aTableStru
>...
>
>When I tried to run the form I got an error on line "oServer.GetStru...":
>OLE error code 0x80020010: Invalid calee
>
>Could anyone help me with this error?
David,
I'm not sure if this is it but compile to MTDLL. Next if you're going to use a command that open tables in COM object then wrap it in a private session. ie: below work for me w/o an error :
Define CLASS MyProcedures AS CUSTOM OLEPUBLIC
Procedure GetStruc
Parameters tcTable, taArray
LOCAL oSession as Session
oSession = CREATEOBJECT('myPrivate')
SET DATASESSION TO oSession.DataSessionId
SELECT * from (tcTable) INTO CURSOR crsTemp WHERE .f.
AFIELDS(taArray)
Use
Return
Endproc
ENDDEFINE
DEFINE CLASS myPrivate as Session
DataSession = 2
enddefine
Compiled to MTDLL comget.dll.
And this in Form.Load :
oTest = create('comget.myprocedures')
local array aMyArray[1]
COMARRAY(oTest,11)
oTest.GetStruc('\\cetin\samplespath\employee',@aMyArray)
create cursor myCursor from array aMyArray
Cetin