Reputation: 17331
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 window. 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?
Upvotes: 1
Views: 1154
Reputation: 54812
You can test for the WS_CHILD flag (GetWindowLongPtr
with 'GWL_STYLE') and if it's there call GetAncestor
with 'GA_ROOT' as 'gaFlags'.
Upvotes: 3