InvokeClassFunction

PowerBuilder Native Interface

IPB_Session interface:

InvokeClassFunction method

Description

Invokes system or user global functions.

Syntax

InvokeClassFunction(pbclass cls, pbmethodID mid, PBCallInfo *ci)

Argument

Description

cls

The class that contains the global function. If this is a system function, cls is obtained with GetSystemFunctionsClass; otherwise, it is obtained with FindGroup and FindClass, with the function name as the group/class name.

mid

The pbMethodID returned by GetMethodID.

ci

A pointer to a preallocated PBCallInfo structure.

Return Values

PBXRESULT. Returns PBX_OK for success, or one of the following for failure:

  • PBX_E_INVALID_ARGUMENT

  • PBX_E_INVOKE_METHOD_INACCESSABLE

  • PBX_E_INVOKE_WRONG_NUM_ARGS

  • PBX_E_INVOKE_REFARG_ERROR

  • PBX_E_INVOKE_METHOD_AMBIGUOUS

  • PBX_E_INVOKE_FAILURE

  • PBX_E_INVOKE_FAILURE

Examples

This example gets the PowerBuilder system class and uses it to invoke the double function:

cls = session-> GetSystemClass();
mid = session-> GetMethodID
   (cls, "double", PBRT_FUNCTION, "DA");
session-> InitCallInfo(cls, mid, ci);
ci->pArgs -> GetAt(0) -> SetPBString(mystr);
session -> InvokeClassFunction(cls, mid, ci);

Usage

On return, this method allocates enough spaces for the arguments, and then initializes arguments and return value. You must set appropriate values in the PBCallInfo structure. Note that the structure itself must have been allocated before the call.

See Also