Get handle of Chrome tab window from inside extension?

I wrote a Chrome extension (using NPAPI) that allows my application and Chrome to communicate with each other. All this basically works fine.

What I'm trying to do now is associate the HWND of the Chrome window with a specific window id and bookmark id.

When I'm inside Chrome (through the plugin), I have an identifier and a window ID, and I can do most of the operations based on this.

When I'm outside of Chrome (through my application), I see the window structure and get HWND from different tabs.

Is there a way that I can reliably link them so that my application can tell Chrome how to get information about / from a specific tab?

+4
source share
1 answer

If you have Spy ++, you'll see that the site names remain compatible with the tab window names. You must definitely use this.

To eliminate header conflicts, just call chrome.tabs.query() and chrome.tabs.update() from the extension to save, modify, and restore the tab title. Then use GetCurrentProcess() and EnumWindows() / WindowEnumProc() to get the hierarchy of child windows and match your custom title. You will need to pass it to the EnumWindowsProc callback function.

+2
source

All Articles