Code: Select all
Global CursorPosition.POINT
If OpenWindow(0, 0, 0, 600, 400, "Want to find WindowFromPoint",#PB_Window_SystemMenu)
ButtonGadget(1, 10, 10, 580, 380, "Really BIG Button")
Repeat
Event = WaitWindowEvent()
Select Event
Case #WM_RBUTTONDOWN
Debug "something"
Debug GetCursorPos_(@CursorPosition.POINT) ; value 1 means successful
Debug CursorPosition\x
Debug CursorPosition\y
a1.l = WindowFromPoint_(CursorPosition.POINT)
Debug a1 ; value 0 means NOT successful
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf

