Function _conCallMethodPa() Foundation
Calls a method of an Xbase++ object.
XPPAPIRET _conCallMethodPa(ContainerHandle chResult,
char *mName,
ULONG numParams,
ContainerHandle *chParams);
This function returns NULL if no error occured, otherwise it returns an error code (XPP_ERR_...).
The function _conCallMethodPa() is used to call a method of an Xbase++ object with a variable parameter list. The parameter list is stored in an array and passed over to the method.
#include <windows.h>
#include "xppdef.h"
#include "xpppar.h"
#include "xppcon.h"
XPPRET XPPENTRY MyCAPIFunction(XppParamList paramList)
{ /* Declare and initialize variables */
ContainerHandle chAnimal1, chAnimal2;
ContainerHandle chName, chNewName;
ContainerHandle chParams[2];
/* Two objects are expected as parameters. */
chAnimal1 = _conParam( paramList, 1, NULL );
chAnimal2 = _conParam( paramList, 2, NULL );
/* Create new container containing new name for object */
/* and empty container for other object. */
chNewName = _conPutC( NULLCONTAINER, "Sheep in wolf clothing" );
chName = _conNew( NULLCONTAINER );
/* Retrieve name of object one and set new name for object two. */
_conGetMember( chAnimal1, "NAME", chName );
_conSetMember( chAnimal2, "NAME", chNewName );
/* Prepare method call */
chParams[0]=chAnimal2;
chParams[1]=chName;
/* Call object's method. */
_conCallMethodPa( chAnimal2, "EAT", 2, chParams );
/* Return */
_conReturn( paramList, chName );
/* Release containers */
_conRelease( chAnimal1 );
_conRelease( chAnimal2 );
_conRelease( chName );
_conRelease( chNewName );
_conRelease( chParams );
}
/* Xbase++ code */
CLASS Animal
EXPORTED:
VAR Name
INLINE METHOD Init( cName )
::Name := cName
RETURN self
INLINE METHOD Eat( cFood )
? ::Name, "eats", cFood
RETURN self
ENDCLASS
PROCEDURE Main
LOCAL oWolf := Animal():New( "Wolf" )
LOCAL oSheep := Animal():New( "Sheep" )
CLS
? MyCAPIFunction( oWolf, oSheep )
? oWolf:Name
? oSheep:Name
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.