According to the docs,
window_get_position() takes an optional
window_id argument, the defaults to
0 if not supplied. So, you're sample code appears to be asking for the position of window ID 0.
Next, you pass in that position to
get_window_at_screen_position(), which returns the ID of the window at the specified position. So, since you requested the position of window id
0, I'd expect that second call to tell you that the window at the specified position is windows
0, as it apparently has.
So, this seems to work as expected based on the posted code.
(Comments based solely on your posted code and the docs. I haven't experimented with any of the above).