NPN_Invoke

« Gecko Plugin API Reference « Scripting plugins

Summary

Invokes a method on the given NPObject.

Syntax

#include <npruntime.h>

bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
                const NPVariant *args, uint32_t argCount, NPVariant *result);

Parameters

The function has the following parameters:

npp
The NPP indicating which plugin wants to call the method on the object.
npobj
The object on which to invoke a method.
methodName
A string identifier indicating the name of the method to invoke.
args
An array of arguments to pass to the method.
argCount
The number of arguments in the args array.
result
A pointer to an NPVariant to receive the result returned by the method.

Returns

true if the method was successfully invoked, otherwise false. If the method was invoked successfully, any return value is stored in the NPVariant specified by result.

When the caller no longer needs the result, it must call NPN_ReleaseVariantValue() to release it.

Description

The method arguments are passed as an array of NPVariants, and the number of arguments is passed in. The result of the method invocation is returned through an NPVariant result parameter. If the method invocation succeeds, NPN_Invoke() returns true, else false.

Note: Early on in the development of the scriptability API this method used to be called NPN_Call() but was renamed for consistency.