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'.
精彩评论