开发者

Real hwnd from the point

开发者 https://www.devze.com 2023-03-03 13:20 出处:网络
When we use WindowFromPoint winapi function we usually can get the case, when Point specifies to some control within a window. And in such cases WindowFromPoint returns handle to that control, not to

When we use WindowFromPoint winapi function we usually can get the case, when Point specifies to some control within a window. And in such cases WindowFromPoint returns handle to that control, not to the window that handles that control.

For example in my small test application if I point to the "body" of chrome browser I get the control with class = Chrome_RenderWidgetHostHWND and its hwnd.

But what I need is to get the "parent" window for tha开发者_Go百科t control (which is obviously should be the chrome window).


Traverse the parents using GetAncestor() passing GA_PARENT. This differs from calling GetParent() which will return the owner if the window is a top-level window.


Can't you just use GetParent? Keep traversing until you find the desktop window.

0

精彩评论

暂无评论...
验证码 换一张
取 消