Your theory seems to be OK and the simple
WindowFromPoint()
should do the job well for you.
WindowFromPoint()
usually does not work when the WindowProc of specified HWND returns
HTTRANSPARENT
in response to
WM_NCHITTEST
, but this is very-very rare. In that case
WindowFromPoint()
returns the window behind the specified
HWND
but in our scenario this isn't the problem. I think something must be wrong in your function declaration, and I don't really understand where do you pass the point to the
WindowFromPoint()
function call. Check the correct function declaration
here[
^], and then pass the current cursor position to the function. Let's try it again! :D