I bet you have a sandbox problem.
Your application most likely runs at a "normal" integrity level, so it has no problem sending the WM_PRINT or WM_PRINTCLIENT to the Chrome process. ( PrintWindow uses these messages under covers.)
When you are a plugin in Chrome, I think your code works as a “low” integrity process (which reduces the chances of things like breaking attacks). Thus, it does not surprise me that sending a message to the window of another process fails.
Unfortunately, this does not explain why this works when Chrome has only one tab. Do you find the same instance of Chrome_RenderWidgetHostHWND both in the application and in the plugin if you open multiple tabs? In general, there is one of these windows per tab. How do you find the window?
source share