NPN_GetValue

  • Revision slug: NPN_GetValue
  • Revision title: NPN_GetValue
  • Revision id: 40388
  • Created:
  • Creator: Jonathan_Watt
  • Is current revision? No
  • Comment Add some missing NPNVariable types

Revision Content

{{ Np-browser-api() }}

Summary

Allows the plug-in to query the browser for information

Syntax

#include <npapi.h>
 
NPError NPN_GetValue(NPP         instance,
                     NPNVariable variable,
                     void        *value);

Parameters

This function has the following parameters:

instance
Pointer to the current plug-in instance.
variable
Information the call gets. Values for NPNVariable:
  • NPNVxDisplay =1: Unix only: Returns the current Display
  • NPNVxtAppContext: Unix only: Returns the application's XtAppContext
  • NPNVnetscapeWindow: MS Windows and Unix/X11 only:
    • MS Windows: Gets the native window on which plug-in drawing occurs; returns HWND
    • Unix/X11: Gets the browser toplevel window in which the plug-in is displayed; returns Window
  • NPNVjavascriptEnabledBool: Tells whether JavaScript is enabled; true=JavaScript enabled, false=not enabled
  • NPNVasdEnabledBool: Tells whether SmartUpdate (former name: ASD) is enabled; true=SmartUpdate enabled, false=not enabled
  • NPNVisOfflineBool: Tells whether offline mode is enabled; true=offline mode enabled, false=not enabled
  • NPNVserviceManager:
  • NPNVDOMElement:
  • NPNVDOMWindow:
  • NPNVToolkit:
  • NPNVSupportsXEmbedBool:
  • NPNVWindowNPObject:
  • NPNVPluginElementNPObject:
  • NPNVSupportsWindowless: Tells whether the browser supports windowless plugins. The value parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR.
  • NPNVpluginDrawingModel: (mac only)
  • NPNVsupportsQuickDrawBool : (mac only)
  • NPNVsupportsCoreGraphicsBool : (mac only)
value
Function returns the name of the plug-in in the value parameter.

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

NPN_GetValue returns the browser information set with NPN_SetValue. The queried information is returned in the value parameter.

Unix

The platform-specific values for this parameter are NPNVxDisplay (the current Display), NPNVxtAppContext (the browser's XtAppContext), and NPNVnetscapeWindow (the browser toplevel window in which the plugin is displayed).

You can use NPNVnetscapeWindow to obtain the appropriate Window for the WM_TRANSIENT_FOR property of a dialog box created from the plug-in.

MS Windows

You can use this method to help create a menu or dialog box for a windowless plug-in. In order to bring up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead, it draws directly into the drawable given to it. Use the NPNVnetscapeWindow value to get the native window on which plug-in drawing occurs.

The method returns a value of type HWND. In many cases, a plug-in may still have to create its own window (a transparent child window of the browser window) to act as the owner window for popup menus and modal dialogs. This transparent child window can have its own WindowProc within which the plug-in can deal with WM_COMMAND messages sent to it a result of tracking the popup menu or modal dialog.

See Also

NPN_SetValue, NPP_GetValue

Revision Source

<p>
{{ Np-browser-api() }}
</p>
<h3 name="Summary">Summary</h3>
<p>Allows the plug-in to query the browser for information
</p>
<h3 name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
NPError NPN_GetValue(NPP         instance,
                     NPNVariable variable,
                     void        *value);
</pre>
<h3 name="Parameters">Parameters</h3>
<p>This function has the following parameters:
</p>
<dl><dt>instance
</dt><dd>Pointer to the current plug-in instance.
</dd></dl>
<dl><dt>variable
</dt><dd> Information the call gets. Values for <code>NPNVariable</code>:
<ul><li> <code>NPNVxDisplay</code> =1: Unix only: Returns the current Display
</li><li> <code>NPNVxtAppContext</code>: Unix only: Returns the application's XtAppContext
</li><li> <code>NPNVnetscapeWindow</code>: MS Windows and Unix/X11 only:
<ul><li> MS Windows: Gets the native window on which plug-in drawing occurs; returns HWND
</li><li> Unix/X11: Gets the browser toplevel window in which the plug-in is displayed; returns Window
</li></ul>
</li><li> <code>NPNVjavascriptEnabledBool</code>: Tells whether JavaScript is enabled; true=JavaScript enabled, false=not enabled
</li><li> <code>NPNVasdEnabledBool</code>: Tells whether SmartUpdate (former name: ASD) is enabled; true=SmartUpdate enabled, false=not enabled
</li><li> <code>NPNVisOfflineBool</code>: Tells whether offline mode is enabled; true=offline mode enabled, false=not enabled
</li><li> <code>NPNVserviceManager</code>: </li><li> <code>NPNVDOMElement</code>: </li><li> <code>NPNVDOMWindow</code>: </li><li> <code>NPNVToolkit</code>: </li><li> <code>NPNVSupportsXEmbedBool</code>: </li><li> <code>NPNVWindowNPObject</code>: </li><li> <code>NPNVPluginElementNPObject</code>: </li><li> <code>NPNVSupportsWindowless</code>: Tells whether the browser supports windowless plugins. The <code>value</code> parameter should point to a NPBool, which will be set appropriately if the function returns NPERR_NO_ERROR.
</li><li> <code> NPNVpluginDrawingModel</code>: (mac only)
</li><li> <code>NPNVsupportsQuickDrawBool </code>: (mac only)
</li><li> <code>NPNVsupportsCoreGraphicsBool </code>: (mac only)
</li></ul>
</dd></dl>
<dl><dt>value
</dt><dd> Function returns the name of the plug-in in the value parameter.
</dd></dl>
<h3 name="Returns">Returns</h3>
<ul><li> If successful, the function returns NPERR_NO_ERROR.
</li><li> If unsuccessful, the plug-in is not loaded and 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>NPN_GetValue</code> returns the browser information set with <a href="en/NPN_SetValue">NPN_SetValue</a>. The queried information is returned in the value parameter.
</p>
<h4 name="Unix">Unix</h4>
<p>The platform-specific values for this parameter are <code>NPNVxDisplay</code> (the current Display),
<code>NPNVxtAppContext</code> (the browser's XtAppContext), and <code>NPNVnetscapeWindow</code> (the browser toplevel window in which the plugin is displayed).
</p><p>You can use <code>NPNVnetscapeWindow</code> to obtain the appropriate <code>Window</code> for the WM_TRANSIENT_FOR property of a dialog box created from the plug-in.
</p>
<h4 name="MS_Windows">MS Windows</h4>
<p>You can use this method to help create a menu or dialog box for a windowless plug-in. In order to bring up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead, it draws directly into the drawable given to it. Use the NPNVnetscapeWindow value to get the native window on which plug-in drawing occurs. </p><p>The method returns a value of type HWND. In many cases, a plug-in may still have to create its own window (a transparent child window of the browser window) to act as the owner window for popup menus and modal dialogs. This transparent child window can have its own WindowProc within which the plug-in can deal with WM_COMMAND messages sent to it a result of tracking the popup menu or modal dialog.
</p>
<h3 name="See_Also">See Also</h3>
<p><a href="en/NPN_SetValue">NPN_SetValue</a>, <a href="en/NPP_GetValue">NPP_GetValue</a>
</p>
Revert to this revision