开发者

WindowFromPoint returns handle for controls, but I only want the main window

I'm writing a window spy type thing to add a feature to an application I have. I've got all the code working, but sometimes WindowFromPoint returns a handle for a control instead of the containing w开发者_JS百科indow. For my purposes, I am only concerned with the main containing window. Is there a way for me exclude controls? Or possible detect that the result is a control and recurse upward until I reach the containing window?


You can test for the WS_CHILD flag (GetWindowLongPtr with 'GWL_STYLE') and if it's there call GetAncestor with 'GA_ROOT' as 'gaFlags'.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜