This project is read-only.

CreateThreadObject in VFP2C32 FLL

Topics: General
May 6, 2012 at 4:46 PM
Edited May 6, 2012 at 4:47 PM

Christian,

If I have the following class defined separately in my activevfp.dll. can I simply pass in any VFP prg to be called by your CreateThreaObject???:

 

DEFINE CLASS c1 as session olepublic

      proc MyDoCmd(cCmd as string,p2 as Variant,p3 as Variant,p4 as Variant,p5 as Variant) helpstring 'Execute a command'

            &cCmd

      proc MyEval(cExpr as string,p2 as Variant,p3 as Variant,p4 as Variant,p5 as Variant) helpstring 'Evaluate an expression'

            RETURN &cExpr
      FUNCTION ERROR(nError, cMethod, nLine)

            lcErrMsg = cMethod+'  err#='+STR(nError,5)+' line='+STR(nline,6)+;
              ' '+MESSAGE()+_VFP.SERVERNAME

            COMreturnerror(lcErrMsg,_VFP.SERVERNAME)
      ENDFUNC
ENDDEFINE

This way an enduser developer can just supply VFP code to be run in the background and not get involved with compiling MTDLLs..

May 7, 2012 at 1:49 PM
Edited May 7, 2012 at 1:49 PM

Hello,

yes you can do this.

You have to load the custom code by calling "SET PROCEDURE TO enduserfile.prg" first.

You'll loose some of the features of CreateThreadObject if you implement it that way, e.g. method abortion - or anything that's connected to the magic "CallInfo" property - if you don't pass "THIS" to the underlying functions ...