NPP_New

  • Revision slug: NPP_New
  • Revision title: NPP_New
  • Revision id: 119536
  • Created:
  • Creator: Mgjbot
  • Is current revision? No
  • Comment robot Adding: [[ja:NPP New]]

Revision Content

{{wiki.template('Np-plugin-api')}}

Summary

Creates a new instance of a plug-in.

Syntax

#include <npapi.h>
 
NPError NPP_New(NPMIMEType    pluginType,
                NPP instance, uint16 mode,
                int16 argc,   char *argn[],
                char *argv[], NPSavedData *saved);

Parameters

The function has the following parameters:

pluginType
Pointer to the MIME type for new plug-in instance.
instance
Contains instance-specific private data for the plug-in and the browser. This data is stored in instance->pdata.
mode
Display mode of plug-in. Values:
  • NP_EMBED: (1) Instance was created by an EMBED tag and shares the browser window with other content.
  • NP_FULL: (2) Instance was created by a separate file and is the primary content in the window.
argc
Number of HTML arguments in the EMBED tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays.
argn[]
Array of attribute names passed to the plug-in from the EMBED tag.
argv[]
Array of attribute values passed to the plug-in from the EMBED tag.
saved
Pointer to data saved by NPP_Destroy for a previous instance of this plug-in at the same URL. If non-null, the browser passes ownership of the NPSavedData object back to the plug-in. The plug-in is responsible for freeing the memory for the NPSavedData and the buffer it contains.

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the function returns an error code. For possible values, see Error Codes.

Description

NPP_New creates a new instance of a plug-in. It is called after NP_Initialize and provides the MIME type, embedded or full-screen display mode, and, for embedded plug-ins, information about HTML EMBED arguments.

The plug-in's NPP pointer is valid until the instance is destroyed with NPP_Destroy.

If instance data was saved from a previous instance of the plug-in by the NPP_Destroy function, it is returned in the saved parameter for the current instance to use.

All attributes in the EMBED tag (standard and private) are passed in NPP_New in the argn and argv arrays. The browser ignores any non-standard attributes within an EMBED tag. This gives developers a chance to use private attributes to communicate instance-specific options or other information to the plug-in. Place private options at the end of the list of standard attributes in the EMBED Tag.

See Also

NPP_Destroy, NP_Shutdown, NPP, NPSavedData

{{ wiki.languages( { "ja": "ja/NPP_New" } ) }}

Revision Source

<p>
</p><p>
{{wiki.template('Np-plugin-api')}}
</p>
<h3 name="Summary">Summary</h3>
<p>Creates a new instance of a plug-in.
</p>
<h3 name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
NPError NPP_New(NPMIMEType    pluginType,
                NPP instance, uint16 mode,
                int16 argc,   char *argn[],
                char *argv[], NPSavedData *saved);
</pre> 
<h3 name="Parameters">Parameters</h3>
<p>The function has the following parameters:
</p>
<dl><dt>pluginType
</dt><dd>Pointer to the MIME type for new plug-in instance.
</dd></dl>
<dl><dt>instance
</dt><dd>Contains instance-specific private data for the plug-in and the browser. This data is stored in instance-&gt;pdata.
</dd></dl>
<dl><dt>mode
</dt><dd>Display mode of plug-in. Values:
<ul><li> NP_EMBED: (1) Instance was created by an EMBED tag and shares the browser window with other content.
</li><li> NP_FULL: (2) Instance was created by a separate file and is the primary content in the window. 
</li></ul>
</dd></dl>
<dl><dt>argc
</dt><dd>Number of HTML arguments in the EMBED tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays.
</dd></dl>
<dl><dt>argn[] 
</dt><dd>Array of attribute names passed to the plug-in from the EMBED tag.
</dd></dl>
<dl><dt>argv[]
</dt><dd>Array of attribute values passed to the plug-in from the EMBED tag.
</dd></dl>
<dl><dt>saved
</dt><dd>Pointer to data saved by <a href="en/NPP_Destroy">NPP_Destroy</a> for a previous instance of this plug-in at the same URL. If non-null, the browser passes ownership of the <a href="en/NPSavedData">NPSavedData</a> object back to the plug-in. The plug-in is responsible for freeing the memory for the <a href="en/NPSavedData">NPSavedData</a> and the buffer it contains.
</dd></dl>
<h3 name="Returns">Returns</h3>
<ul><li> If successful, the function returns NPERR_NO_ERROR.
</li><li> If unsuccessful, the function returns an error code. For possible values, see <a href="en/NPAPI/Constants#Error_Codes">Error Codes</a>.
</li></ul>
<h3 name="Description">Description</h3>
<p><code>NPP_New</code> creates a new instance of a plug-in. It is called after <a href="en/NP_Initialize">NP_Initialize</a> and provides the MIME type, embedded or full-screen display mode, and, for embedded plug-ins, information about HTML EMBED arguments.
</p><p>The plug-in's <a href="en/NPP">NPP</a> pointer is valid until the instance is destroyed with <a href="en/NPP_Destroy">NPP_Destroy</a>.
</p><p>If instance data was saved from a previous instance of the plug-in by the <a href="en/NPP_Destroy">NPP_Destroy</a> function, it is returned in the saved parameter for the current instance to use.
</p><p>All attributes in the EMBED tag (standard and private) are passed in <code>NPP_New</code> in the argn and argv arrays. The browser ignores any non-standard attributes within an EMBED tag. This gives developers a chance to use private attributes to communicate instance-specific options or other information to the plug-in. Place private options at the end of the list of standard attributes in the EMBED Tag.
</p>
<h3 name="See_Also">See Also</h3>
<p><a href="en/NPP_Destroy">NPP_Destroy</a>, <a href="en/NP_Shutdown">NP_Shutdown</a>, <a href="en/NPP">NPP</a>, <a href="en/NPSavedData">NPSavedData</a>
</p>{{ wiki.languages( { "ja": "ja/NPP_New" } ) }}
Revert to this revision