Given an x, y point, how do I get a window handle for a control that is NOT present in the foreground window?

I know that WindowFromPoint can be used to get a handle to a control if that control is in a visible window. My requirement is to get control details, even if the application window is not in the foreground (it is not minimized, simply because it may be located behind another window). Is a WINAPI function available that can do this for me?

If not, can anyone suggest an approach to how I can do this, which is missing: 1. Listing all the controls in a specific background window, 2. then get their borders, 3. and then compare if these borders contain the x, y coordinate?

+3
source share
2 answers

You are looking for the GetWindow API function that can be used to list all windows, and then GetWindowRect .

+1
source

Maybe it WM_NCHITTESTcan help? See For example WM_NCHITTEST for testing for hits, and removal testing may occur for reasons other than the mouse located above your window on the Old New Thing page.

A message WM_NC­HIT­TESTdoes not mean that the mouse is in your window; it just means that someone asks: "If the mouse was in your window, what would it do?"

0
source

Source: https://habr.com/ru/post/1794401/


All Articles