Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

vba - Find the Window handle for a Chrome Browser

I have found some code to bring the browser to the front, even if it was minimized. I don't however know how to get the hwnd for the browser.

I have had a look at the FindWindow API function, but you need the classname and windowname. I have found that the classname I require is "Chrome_WidgetWin_1" The windowname though would be constantly changing depending on what was open in the browser.

I think one of the 'children' of this window has a classname of "WrapperNativeWindowClass" I'm not sure if I can use this to find the original parent.

Can anyone advise on how to find the window handle of a chrome browser (using VBA)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

A typical Chrome/Chromium run session (multi-process, handling rendering/out of process iframes and offline-browser-applications and (standard) extensions.

typical run NirSoft's excellent WinExplorer tool (among many many others)

shows the following (probably similar to yours) class displays enter image description here

try looking for both Chrome_WidgetWin_1 and Chrome_RenderWidgetHostHWND


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...