When NP_GetEntryPoints is called, set the NPPluginFuncs's arg's field
setwindow to a function with signature: NPError SetWindow(NPP
instance, NPWindow *window);
My example:
NPError WINAPI NP_GetEntryPoints(NPPluginFuncs *plugin_funcs) {
plugin_funcs->setwindow = SetWindow;
}
NPError SetWindow(NPP instance, NPWindow *window) {
HWND hwnd = (HWND)window->window;
if (hwnd != NULL) {
....
}
}
the NPWindow on windows will be an object with field named window
which is an HWND. On other platforms, this is different. The first
time SetWindow is called, window->window will probably be NULL, so
check for that too. If it contains a non-NULL value, it contains the
current (latest) window for the plugin object.
> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
>
1) Inject an NPAPI object (with zero height and width, perhaps) into
every tab, and grab the HWNDs when SetWindow is called for each of
them.
2) Traverse the tree of HWNDs to find a parent process's HWND, and
find its children. Each tab has a HWND with class name
Chrome_RenderWidgetHostHWND and Spy++ will help you work out what's
going on - use http://msdn.microsoft.com/en-us/library/ff468919(v=VS.85).aspx
to traverse the hierarchy. Note that this is horrible and brittle.
There currently isn't a way to find an arbitrary window's HWND (I can
see why this would be useful - perhaps add a feature request to
http://crbug.com/new)