Page 1 of 1

Ver 4.51 - Problem with WindowFromPoint_()

Posted: Thu Feb 17, 2011 2:59 pm
by Randy Walker
I can debug valid CursorPosition\x and y values so I know the POINT structure populated Ok, so where am I going wrong with WindowFromPoint? It always gives me a zero value...

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

Re: Ver 4.51 - Problem with WindowFromPoint_()

Posted: Thu Feb 17, 2011 3:14 pm
by RASHAD
Hi

Code: Select all

a1.l = WindowFromPoint_(CursorPosition\y<< 32 + CursorPosition\x)

Re: Ver 4.51 - Problem with WindowFromPoint_()

Posted: Thu Feb 17, 2011 3:45 pm
by Randy Walker
That seems to work. :| Thanks Rashad!! :)

I guess Microsoft failed to update that syntax change when I upgraded to PB 4.51 :D