0

how can I get the handle for the browser window what hosts a plugin window? I would like to inquire its size so I can properly resize my plugin window.

Hope that makes sense, Christian

chhenning
  • 2,017
  • 3
  • 26
  • 44

2 Answers2

1

You should never be resizing your plugin HWND; the browser does that. If you're resizing it without the browser's intervention you're breaking the contract and will likely end up in conflict with future changes of the browser which is assuming that you're allowing it to size you according to the DOM, not according to the root document window.

Just FYI.

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • I'm using the browser window size as a hint to resize my plugin window using the DOMElement method you mentioned here: http://stackoverflow.com/questions/11084694/how-does-a-plugin-resize-its-window – chhenning Sep 26 '12 at 17:13
  • if you're doing that, why not just use the sizes already provided in the DOM? the size of the actual browser window may or may not have any consistent relationship to the page itself – taxilian Sep 26 '12 at 17:49
  • I mean you can get the width and height of the document; you can also get the width and height of the visible area. Why would you go through the OS to get the actual HWND size when you can just ask the window its size through javascript? – taxilian Sep 29 '12 at 03:36
0

For Windows user the solution is to call GetAncestor:

FB::PluginWindowWin* w = (FB::PluginWindowWin*)(fb_win);
HWND hWndBrowser = GetAncestor( w->getHWND(), GA_ROOTOWNER );

A thread on google groups explains a bit more:

https://groups.google.com/forum/?fromgroups=#!topic/firebreath-dev/4aMXWI94RzY

Christian

chhenning
  • 2,017
  • 3
  • 26
  • 44