I am trying to get a windows position by it's handle. Then I want to draw a cross at the windows 0, 0 position like so (notepad is near the top-left of the display):
but if I move notepad near the bottom right it looks like this:
That's totally weird for me. I've logged the values of rect.Left and rect.Top and compared them with the values of Spy++, they were the same.
What i've tried: from user32.dll:
GetWindowRect(handle, out var rect);
from dwmapi.dll:
DwmGetWindowAttribute(handle, DWMWINDOWATTRIBUTE.ExtendedFrameBounds, out var rect, size);
That worked a bit better, but still the same behaviour.
Someone knows a way to find the windows 0, 0 independently where the window is?