NPN_Invoke

  • Revision slug: NPN_Invoke
  • Revision title: NPN_Invoke
  • Revision id: 128393
  • Created:
  • Creator: toaarnio
  • Is current revision? Yes
  • Comment 3 words removed

Revision Content

{{ Np-plugin-scripting() }}

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.

Revision Source

<p>{{ Np-plugin-scripting() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Invokes a method on the given <code><a href="/en/NPObject" title="en/NPObject">NPObject</a></code>.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>#include &lt;npruntime.h&gt;
 
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
                const NPVariant *args, uint32_t argCount, NPVariant *result);
</pre>
<h3 id="Parameters" name="Parameters">Parameters</h3>
<p>The function has the following parameters:</p>
<dl> <dt><code>npp</code></dt> <dd>The <a href="/en/NPP" title="en/NPP">NPP</a> indicating which plugin wants to call the method on the object.</dd> <dt><code>npobj</code></dt> <dd>The object on which to invoke a method.</dd> <dt><code>methodName</code></dt> <dd>A string identifier indicating the name of the method to invoke.</dd> <dt><code>args</code></dt> <dd>An array of arguments to pass to the method.</dd> <dt><code>argCount</code></dt> <dd>The number of arguments in the <code>args</code> array.</dd> <dt><code>result</code></dt> <dd>A pointer to an <code><a href="/en/NPVariant" title="en/NPVariant">NPVariant</a></code> to receive the result returned by the method.</dd>
</dl>
<h3 id="Returns" name="Returns">Returns</h3>
<p><code>true</code> if the method was successfully invoked, otherwise <code>false</code>. If the method was invoked successfully, any return value is stored in the <code>NPVariant</code> specified by <code>result</code>.</p>
<p>When the caller no longer needs the <code>result</code>, it must call <code><a href="/en/NPN_ReleaseVariantValue" title="en/NPN_ReleaseVariantValue">NPN_ReleaseVariantValue()</a></code> to release it.</p>
<h3 id="Description" name="Description">Description</h3>
<p>The method arguments are passed as an array of <code>NPVariant</code>s, and the number of arguments is passed in. The result of the method invocation is returned through an <code>NPVariant</code> result parameter. If the method invocation succeeds, <code>NPN_Invoke()</code> returns <code>true</code>, else <code>false</code>.</p>
<div class="note"><strong>Note:</strong> Early on in the development of the scriptability API this method used to be called <code>NPN_Call()</code> but was renamed for consistency.</div>
Revert to this revision