Welcome to OGeek Q&A 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...