Re: NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, NPVariant *result);

[email protected] Mon, 22 Apr 2013 03:15:23 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.plugins
Message-ID <[email protected]>
On Monday, April 22, 2013 11:11:16 AM UTC+2, [email protected] wrote:
> On Tuesday, July 10, 2012 7:02:44 AM UTC+2, jupiter wrote:
> 
> > we have developed plugin that uses NPN_GetProperty() function to retrieve ScreenX ScreenY etc value.
> 
> > 
> 
> >  But the NPN_GetProperty() is failing for firefox for some perticular flash website. what could be the reason for the failure ?
> 
> 
> 
> Hi,
> 
> 
> 
> I'm trying to get the screen size by using NPN_GetProperty() but can't make it work. Could you post some example code on how you get ScreenX etc.
> 
> 
> 
> /Christian

I found a solution to my problem, and just want to post it for further reference.

NPIdentifier screenId = browser->getstringidentifier("screen");
            NPIdentifier heightId = browser->getstringidentifier("height");
            NPIdentifier widthId = browser->getstringidentifier("width");

            NPObject *window_obj = NULL;
            browser->getvalue(mNPPInstance, NPNVWindowNPObject, &window_obj);

            NPVariant screen_var;
            browser->getproperty(mNPPInstance, window_obj, screenId, &screen_var);
            
            NPVariant height_var;
            browser->getproperty(mNPPInstance, NPVARIANT_TO_OBJECT(screen_var), heightId, &height_var);
            NPVariant width_var;
            browser->getproperty(mNPPInstance, NPVARIANT_TO_OBJECT(screen_var), widthId, &width_var);